-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathflake.nix
61 lines (56 loc) · 1.79 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
{
description = "Environment for Jupyter Book";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05";
utils.url = "github:numtide/flake-utils";
poetry2nix = {
url = "github:nix-community/poetry2nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, utils, poetry2nix}: (utils.lib.eachSystem ["x86_64-linux" ] (system:
let
pkgs = import nixpkgs {
inherit system;
config.cudaSupport = true;
config.allowUnfree = true;
overlays = [
poetry2nix.overlays.default
];
};
pypkgs-build-requirements = {
# hbreader = [ "setuptools" ];
};
p2n-overrides = pkgs.poetry2nix.defaultPoetryOverrides.extend (self: super:
builtins.mapAttrs (package: build-requirements:
(builtins.getAttr package super).overridePythonAttrs (old: {
buildInputs = (old.buildInputs or [ ]) ++ (builtins.map (pkg: if builtins.isString pkg then builtins.getAttr pkg super else pkg) build-requirements);
})
) pypkgs-build-requirements
);
args = {
projectDir = ./.;
preferWheels = true;
overrides = p2n-overrides;
python = pkgs.python313;
};
env = pkgs.poetry2nix.mkPoetryEnv args;
app = pkgs.poetry2nix.mkPoetryApplication args;
in
rec {
## See https://github.com/nix-community/poetry2nix/issues/1433
## It seems like poetry2nix does not seem to install as dev
## environment
## devShells.default = env.env;
devShells.default = pkgs.mkShell {
packages = [ env ];
shellHook = ''
export PYTHONPATH=$PWD
'';
};
packages.amdt = app;
packages.default = self.packages.${system}.amdt;
}
)
);
}