neurenv/flake.nix
2026-07-11 18:20:01 -04:00

41 lines
805 B
Nix

{
description = "NEURON with custom mechanisms";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs";
};
outputs = { self, nixpkgs }:
let
system = "x86_64-linux";
pkgs = import nixpkgs { inherit system; };
python = pkgs.python3.withPackages (ps: with ps; [
numpy
pandas
scipy
]);
in {
devShells.${system}.default = pkgs.mkShell {
packages = [
pkgs.neuron
python
];
shellHook = ''
export MECH_DIR=$PWD/mech
export NRN_NMODL_PATH=$MECH_DIR
if [ ! -f "$MECH_DIR/x86_64/.libs/libnrnmech.so" ]; then
echo "Compiling NEURON mechanisms..."
nrnivmodl $MECH_DIR
fi
export NRNMECH_LIB_PATH=$MECH_DIR/x86_64/.libs/libnrnmech.so
'';
};
};
}