-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #48 from calpolyccg/nix-poetry
Add a Nix development enviornment to MD-SAPT
- Loading branch information
Showing
8 changed files
with
2,352 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
use flake | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -117,3 +117,8 @@ ENV/ | |
# MDSAPT-generated files | ||
timer.dat | ||
input.yaml | ||
*.out | ||
|
||
# Direnv files | ||
.direnv/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
{ | ||
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" ]; | ||
#matplotlib = [ "pybind11" ]; | ||
#scipy = [ "setuptools" "wheel" "pybind11" "pythran" ]; | ||
}; | ||
|
||
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 ]; | ||
}; | ||
|
||
devEnv = pkgs.mkShell { | ||
propagatedBuildInputs = [ poetryEnv]; | ||
buildInputs = with pkgs; [pkgs.qchem.psi4 pkgs.qchem.openmm pkgs.qchem.pdbfixer ]; | ||
}; | ||
|
||
# DON'T FORGET TO PUT YOUR PACKAGE NAME HERE, REMOVING `throw` | ||
packageName = "MD-SAPT"; | ||
|
||
in { | ||
devShells.default = devEnv; | ||
}); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.