-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathflake.nix
92 lines (71 loc) · 2.66 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
{
description = "SAPT energy calculator built using MDAnalysis and Psi4 ";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
poetry2nix.url = "github:nix-community/poetry2nix";
qchem.url = "github:Nix-QChem/NixOS-QChem";
};
outputs = { self, nixpkgs, flake-utils, poetry2nix, qchem }:
flake-utils.lib.eachDefaultSystem (system:
let
lib = nixpkgs.lib;
pkgs = import nixpkgs {
system = system;
overlays = [
qchem.overlays.qchem
poetry2nix.overlays.default
];
};
# Build dependencies for pacakges
pypkgs-build-reqs = {
mdanalysis = [ "setuptools" ];
mda-xdrlib = [ "setuptools" ];
mmtf-python = [ "setuptools" ];
mrcfile = [ "setuptools" ];
griddataformats = [ "setuptools" ];
pyright = [ "setuptools" ];
};
p2n-overrides = pkgs.poetry2nix.defaultPoetryOverrides.extend (final: prev:
builtins.mapAttrs (package: build-reqs:
(builtins.getAttr package prev).overridePythonAttrs (old: {
buildInputs = (old.buildInputs or [ ]) ++ (builtins.map (pkg: if builtins.isString pkg then builtins.getAttr pkg prev else pkg) build-reqs);
})
) pypkgs-build-reqs
);
unfuckScipy = final: prev: {
scipy = pkgs.python311Packages.scipy;
};
unfuckNumpy = final: prev: {
numpy = pkgs.python311Packages.numpy;
};
python = pkgs.python311.override {
packageOverrides = unfuckScipy;
};
poetryEnv = pkgs.poetry2nix.mkPoetryEnv {
projectDir = ./.;
python = python;
overrides = [ p2n-overrides unfuckScipy unfuckNumpy ]; #unfuckScipy ];
};
nonPoetryPkgs = final: prev: {
psi4 = pkgs.qchem.psi4;
openmm = pkgs.qchem.openmm;
pdbfixer = pkgs.qchem.pdbfixer;
};
devEnv = pkgs.mkShell {
propagatedBuildInputs = [ poetryEnv ];
buildInputs = with pkgs; [pkgs.qchem.psi4 pkgs.qchem.openmm pkgs.qchem.pdbfixer pkgs.act ];
};
# DON'T FORGET TO PUT YOUR PACKAGE NAME HERE, REMOVING `throw`
packageName = "MD-SAPT";
app = pkgs.poetry2nix.mkPoetryApplication {
projectDir = ./.;
python = python;
overrides = [ p2n-overrides nonPoetryPkgs unfuckScipy unfuckNumpy ];
};
in {
packages.${packageName} = app;
packages.default = self.packages.${system}.${packageName};
devShells.default = devEnv;
});
}