From fc2812a1f8a2b74ce0ab9a36912e9298b2027bfe Mon Sep 17 00:00:00 2001 From: Jiajie Chen Date: Tue, 1 Nov 2022 10:45:33 +0800 Subject: [PATCH] nest: init at 3.3 --- .../science/biology/nest/default.nix | 70 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 4 ++ pkgs/top-level/python-packages.nix | 2 + 3 files changed, 76 insertions(+) create mode 100644 pkgs/applications/science/biology/nest/default.nix diff --git a/pkgs/applications/science/biology/nest/default.nix b/pkgs/applications/science/biology/nest/default.nix new file mode 100644 index 000000000000..01874763901b --- /dev/null +++ b/pkgs/applications/science/biology/nest/default.nix @@ -0,0 +1,70 @@ +{ lib +, stdenv +, fetchFromGitHub +, testers +, cmake +, gsl +, libtool +, mpi +, nest +, pkg-config +, python3 +, readline +, autoPatchelfHook +, withPython ? false +, withMpi ? false +}: + +stdenv.mkDerivation rec { + pname = "nest"; + version = "3.3"; + + src = fetchFromGitHub { + owner = "nest"; + repo = "nest-simulator"; + rev = "v${version}"; + sha256 = "sha256-wmn5LOOHlSuyPdV6O6v7j10dxdcvqpym6MfveZdL+dU="; + }; + + postPatch = '' + patchShebangs cmake/CheckFiles/check_return_val.sh + # fix PyNEST installation path + # it expects CMAKE_INSTALL_LIBDIR to be relative + substituteInPlace cmake/ProcessOptions.cmake \ + --replace "\''${CMAKE_INSTALL_LIBDIR}/python" "lib/python" + ''; + + nativeBuildInputs = [ + cmake + pkg-config + autoPatchelfHook + ]; + + buildInputs = [ + gsl + readline + libtool # libltdl + ] ++ lib.optionals withPython [ + python3 + python3.pkgs.cython + ] ++ lib.optional withMpi mpi; + + cmakeFlags = [ + "-Dwith-python=${if withPython then "ON" else "OFF"}" + "-Dwith-mpi=${if withMpi then "ON" else "OFF"}" + "-Dwith-openmp=${if stdenv.isDarwin then "OFF" else "ON"}" + ]; + + passthru.tests.version = testers.testVersion { + package = nest; + command = "nest --version"; + }; + + meta = with lib; { + description = "NEST is a command line tool for simulating neural networks"; + homepage = "https://www.nest-simulator.org/"; + license = licenses.gpl2; + maintainers = with maintainers; [ jiegec ]; + platforms = platforms.unix; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 70d0aa64c71c..e7f64ad78579 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -35278,6 +35278,10 @@ with pkgs; n3 = callPackage ../applications/science/biology/N3 { }; + nest = callPackage ../applications/science/biology/nest { }; + + nest-mpi = callPackage ../applications/science/biology/nest { withMpi = true; }; + neuron = callPackage ../applications/science/biology/neuron { python = null; }; neuron-mpi = neuron.override {useMpi = true; }; diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index af0c07084a9f..5c79953c8a5d 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -6069,6 +6069,8 @@ self: super: with self; { nessclient = callPackage ../development/python-modules/nessclient { }; + nest = toPythonModule(pkgs.nest-mpi.override { withPython = true; python3 = python; }); + nest-asyncio = callPackage ../development/python-modules/nest-asyncio { }; nested-lookup = callPackage ../development/python-modules/nested-lookup { };