-
Notifications
You must be signed in to change notification settings - Fork 151
/
flake.nix
56 lines (46 loc) · 1.49 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
{
description = "Python environment for fipy";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/de02e640d0e7787441326133b6de1b44b2d3865f";
utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, utils}: (utils.lib.eachSystem [ "x86_64-linux" "x86_64-darwin" "aarch64-darwin" ] (system:
let
pkgs = nixpkgs.legacyPackages.${system};
pypkgs = pkgs.python312Packages;
env = (pypkgs.fipy.overridePythonAttrs (old: rec {
src = pkgs.lib.cleanSource ./.;
disabled = pypkgs.pythonOlder "3.7";
nativeBuildInputs_ = with pypkgs; [
pip
pkgs.openssh
nbval
ipython
ipykernel
jupyterlab
traitlets
notebook
scipy
];
nativeBuildInputs = propagatedBuildInputs;
propagatedBuildInputs = old.propagatedBuildInputs ++ nativeBuildInputs_;
postShellHook = ''
SOURCE_DATE_EPOCH=$(date +%s)
export PYTHONUSERBASE=$PWD/.local
export USER_SITE=`python -c "import site; print(site.USER_SITE)"`
export PYTHONPATH=$PYTHONPATH:$USER_SITE:$(pwd):$PWD
export PATH=$PATH:$PYTHONUSERBASE/bin
export OMPI_MCA_plm_rsh_agent=${pkgs.openssh}/bin/ssh
'';
}));
in
rec {
packages.fipy = env;
packages.default = self.packages.${system}.fipy;
devShells.default = pkgs.mkShell {
packages = [ env ];
};
devShells.develop = env;
}
));
}