From 5dda9ad9576fdad4f51cecf23837ffc96cd5c364 Mon Sep 17 00:00:00 2001 From: Antoine Fauroux Date: Tue, 9 Jun 2026 16:23:01 -0400 Subject: [PATCH] kcnhub: packages: python: nestml --- flake.nix | 5 +- machines/kcnhub/packages/python.nix | 4 ++ overlays/packages.nix | 12 +++++ overlays/python-packages.nix | 84 +++++++++++++++++++++++++++++ 4 files changed, 103 insertions(+), 2 deletions(-) create mode 100644 overlays/packages.nix diff --git a/flake.nix b/flake.nix index 73a5229..5bdabb0 100644 --- a/flake.nix +++ b/flake.nix @@ -43,6 +43,7 @@ }; }; python-overlay = import ./overlays/python.nix attrs; + package-overlays = import ./overlays/packages.nix attrs; applyOverlays = overlays: ({...}:{ nixpkgs.overlays = overlays; }); flakes = {...}: {nix.settings.experimental-features = [ "nix-command" "flakes" ];}; in { @@ -51,7 +52,7 @@ specialArgs = attrs; modules = [ flakes - (applyOverlays [ unfree-overlay unstable-overlay python-overlay ]) + (applyOverlays [ unfree-overlay unstable-overlay python-overlay package-overlays ]) vscode-server.nixosModules.default ./machines/kcnhub/configuration.nix sops-nix.nixosModules.sops @@ -59,7 +60,7 @@ }; overlays = { - default = applyOverlays [ unfree-overlay unstable-overlay python-overlay ]; + default = applyOverlays [ unfree-overlay unstable-overlay python-overlay package-overlays ]; unstable = unstable-overlay; }; }; diff --git a/machines/kcnhub/packages/python.nix b/machines/kcnhub/packages/python.nix index c8a67f5..9f52ad1 100644 --- a/machines/kcnhub/packages/python.nix +++ b/machines/kcnhub/packages/python.nix @@ -9,6 +9,9 @@ }; config = { environment.systemPackages = with pkgs; [ + # For nestml + cmake + gnumake ((pkgs.python3.withPackages config.pythonPackages).override (args: { ignoreCollisions = true; })) ]; pythonPackages = (p: with p; [ @@ -40,6 +43,7 @@ (nest.override { withMpi = false; }) + nestml brian2 # SpiNNaker simulator spynnaker diff --git a/overlays/packages.nix b/overlays/packages.nix new file mode 100644 index 0000000..40430b3 --- /dev/null +++ b/overlays/packages.nix @@ -0,0 +1,12 @@ +inputs: final: prev: { + nest = prev.nest.overrideAttrs (old: { + postPatch = old.postPatch + '' + sed -e 's#-L$prefix/#-L#g' -i bin/nest-config.in + ''; + }); + nest-mpi = prev.nest-mpi.overrideAttrs (old: { + postPatch = old.postPatch + '' + sed -e 's#-L$prefix/#-L#g' -i bin/nest-config.in + ''; + }); +} diff --git a/overlays/python-packages.nix b/overlays/python-packages.nix index 9c01133..c6cc8d1 100644 --- a/overlays/python-packages.nix +++ b/overlays/python-packages.nix @@ -1,4 +1,88 @@ final: final-py: prev-py: { + nestml = let + pname = "nestml"; + # Newer versions require newer antlr4 + version = "7.0.2"; + in final-py.buildPythonPackage { + inherit pname version; + + src = final.fetchFromGitHub { + owner = "nest"; + repo = pname; + rev = "v${version}"; + hash = "sha256-BQzwIh2Gdq+rLwIwe7dyltDfEzpaIWGlXF0AfZGBUDw="; + }; + + doCheck = false; + dontUseCmakeConfigure = true; + + propagatedBuildInputs = with final-py; [ + numpy + scipy + sympy + antlr4-python3-runtime + #setuptools + jinja2 + astropy + semver + odetoolbox + ]; + }; + + odetoolbox = let + pname = "ode-toolbox"; + version = "2.5.8"; + in final-py.buildPythonPackage { + inherit pname version; + + src = final.fetchFromGitHub { + owner = "nest"; + repo = pname; + rev = "v${version}"; + hash = "sha256-do/R9tNXVdeoqQO5ofetP7jdq9VUq4UotO6LH3LL6jI="; + }; + + buildInputs = with final-py; [ + pytest + pytest-runner + ]; + + doCheck = false; + + propagatedBuildInputs = with final-py; [ + matplotlib + graphviz + sympy + scipy + numpy + cython + ]; + }; + + pytest-runner = let + pname = "pytest-runner"; + version = "6.0.0"; + in final-py.buildPythonPackage { + inherit pname version; + pyproject = true; + + src = final.fetchFromGitHub { + owner = "pytest-dev"; + repo = pname; + rev = "v${version}"; + leaveDotGit = true; + hash = "sha256-cfUqEu3vN2i8jKZcTxId8Q/T/ld25qBeXY63g0eJnPs="; + }; + + nativeBuildInputs = [ + final.git + ]; + + propagatedBuildInputs = with final-py; [ + setuptools-scm + ]; + }; + mne-python = prev-py.mne-python.overridePythonAttrs (old: { pyproject = true; format = null;