master-thesis/python/flake.nix

62 lines
1.7 KiB
Nix

{
description = "Calculating open system bath energy changes with HOPS and analytically.";
inputs = {
nixpkgs.url = "nixpkgs/nixos-unstable";
utils.url = "github:vale981/hiro-flake-utils";
};
outputs = { self, utils, nixpkgs, ... }:
(utils.lib.poetry2nixWrapper nixpkgs {
name = "hopsflow";
shellPackages = pkgs: with pkgs; [ black pyright ];
poetryArgs = {
projectDir = ./.;
};
});
outputs = { self, nixpkgs, flake-utils, mach-nix, hopsflow, hops }:
let
python = "python39";
in flake-utils.lib.eachSystem ["x86_64-linux"] (system:
let
pkgs = nixpkgs.legacyPackages.${system};
mach-nix-wrapper = import mach-nix { inherit pkgs python; };
hopsflowPkg = hopsflow.defaultPackage.${system};
pythonShell = mach-nix-wrapper.mkPython {
requirements = ''
numba
quadpy
idesolver
ptpython
matplotlib
jupyter
qutip
mkl
sqlitedict
'';
packagesExtra = [
hopsflowPkg
hops.defaultPackage.${system}
];
_.jupyter.postInstall = ''
rm $out/lib/python*/site-packages/__pycache__/jupyter.cpython-39.pyc
rm $out/lib/python*/site-packages/jupyter.py
'';
providers.tk = "nixpkgs";
};
in {
devShell = pkgs.mkShell {
buildInputs = with pkgs; [pythonShell sshfs pyright sage];
shellHook = ''
export PYTHONPATH=$PYTHONPATH:$(realpath ./energy_flow_proper)
'';
};
});
}