-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
77 lines (66 loc) · 2.11 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
{
description = "";
inputs = {
nixpkgs.url = "nixpkgs";
flake-parts.url = "github:hercules-ci/flake-parts";
poetry2nix = {
url = "github:nix-community/poetry2nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = inputs@{ flake-parts, ... }:
flake-parts.lib.mkFlake { inherit inputs; } {
systems = inputs.nixpkgs.lib.systems.flakeExposed;
perSystem = { config, self', inputs', pkgs, system, ... }:
let
lib = pkgs.lib;
poetry2nixLib = (inputs.poetry2nix.lib.mkPoetry2Nix { inherit pkgs; });
buildInputs-base = with pkgs; [
graphviz
];
p2n-overrides = poetry2nixLib.defaultPoetryOverrides.extend
(self: super: {
clipboard = super.clipboard.overridePythonAttrs (
old: { buildInputs = (old.buildInputs or [ ]) ++ [ super.setuptools ]; }
);
});
poetryAttrs = {
projectDir = ./.;
python = pkgs.python311;
overrides = p2n-overrides;
preferWheels = true; # I don't want to compile all that
};
devEnv = poetry2nixLib.mkPoetryEnv (poetryAttrs // {
groups = [ "dev" "test" ];
});
devEnvPopulated =
(devEnv.env.overrideAttrs (oldAttrs: rec {
name = "py";
buildInputs = with pkgs;
(oldAttrs.buildInputs or [ ])
++ buildInputs-base
++ [
];
shellHook = ''
export MYPYPATH=$PWD/sponge_networks/
'';
}));
sponge-networks = (poetry2nixLib.mkPoetryApplication poetryAttrs).overrideAttrs
(oldAttrs: rec {
buildInputs = (oldAttrs.buildInputs or [ ])
++ (with pkgs;
buildInputs-base ++ [
]);
});
in
{
devShells = {
default = devEnvPopulated;
};
packages = {
devEnv = devEnv;
default = sponge-networks;
};
};
};
}