diff --git a/overlays/python-packages.nix b/overlays/python-packages.nix index 1d7a21f..9f10fec 100644 --- a/overlays/python-packages.nix +++ b/overlays/python-packages.nix @@ -30,4 +30,4 @@ final: final-py: prev-py: { numpy ]; }; -} +} // (import ./spynnaker.nix final final-py prev-py) diff --git a/overlays/spynnaker.nix b/overlays/spynnaker.nix new file mode 100644 index 0000000..551644e --- /dev/null +++ b/overlays/spynnaker.nix @@ -0,0 +1,582 @@ +final: final-py: prev-py: let + SpiNNFrontEndCommon_C_Models = final.stdenv.mkDerivation { + pname = "SpiNNFrontEndCommon"; + version = "1!7.1.1"; + src = final.fetchFromGitHub { + owner = "SpiNNakerManchester"; + repo = "SpiNNFrontEndCommon"; + rev = "c3f8c980fd51d40032524150c563feac787532ae"; + hash = "sha256-lJwoFmICQdnLaalFcFGnLnGiE+puuV2fQHM1wqHiiFY="; + }; + buildInputs = with final; [ + final-py.spinn_common + which + gcc-arm-embedded-10 + (final-py.python.withPackages (p: with p; [ + SpiNNUtilities + ])) + ]; + preConfigure = '' + mkdir SPINN_DIRS + cp -r ${final-py.spinn_common}/SPINN_DIRS/* SPINN_DIRS + chmod +rw -R SPINN_DIRS + export SPINN_DIRS=$PWD/SPINN_DIRS + export GNUTOOLS=${final.gcc-arm-embedded-10} + export GNUBIN=$GNUTOOLS/bin + export C_LOGS_DICT=$PWD/spinn_front_end_common/common_model_binaries/logs.sqlite3 + pushd c_common + ''; + + installPhase = '' + popd + mkdir $out + cp -r * $out + ''; + }; + + spynnaker_c = final.stdenv.mkDerivation { + pname = "spynnaker"; + version = "1!7.1.1"; + + src = final.fetchFromGitHub { + owner = "SpiNNakerManchester"; + repo = "sPyNNaker"; + rev = "6f7455badeeea223dda85cd0aab9e5f5086f843b"; + hash = "sha256-zXssngB+A6zoH5X2FOI10biUNXNlwh0tySje/JMoZ0w="; + }; + + buildInputs = with final; [ + (final-py.python.withPackages (p: with p; [ + SpiNNFrontEndCommon + ])) + gcc-arm-embedded-10 + ]; + + preConfigure = '' + mkdir SPINN_DIRS + cp -r ${SpiNNFrontEndCommon_C_Models}/SPINN_DIRS/* SPINN_DIRS + chmod +rw -R SPINN_DIRS + export SPINN_DIRS=$PWD/SPINN_DIRS + export GNUTOOLS=${final.gcc-arm-embedded-10} + export GNUBIN=$GNUTOOLS/bin + SLLT_TAG=https://spinnakermanchester.github.io/spinnaker_tools/sllt.tag + COMMON_TAG=https://spinnakermanchester.github.io/spinn_common/common.tag + FEC_TAG=https://spinnakermanchester.github.io/SpiNNFrontEndCommon/c/fec.tag + pushd neural_modelling + export NEURAL_MODELLING_DIRS=$PWD + touch logs.sqlite3 + export C_LOGS_DICT=$PWD/logs.sqlite3 + ''; + + installPhase = '' + popd + mkdir $out + cp -r * $out + ''; + }; +in { + morphio = final-py.toPythonModule ( final.stdenv.mkDerivation rec { + pname = "morphio"; + version = "3.3.9"; + src = final.fetchFromGitHub { + owner = "BlueBrain"; + repo = "MorphIO"; + rev = "v${version}"; + fetchSubmodules = true; + hash = "sha256-qPHuKb9dSnSgEXzeI94Zf3VpMBBssQ0y8lCVzzYB+rA="; + }; + + nativeBuildInputs = (with final; [ + cmake + ninja + hdf5 + final-py.numpy + ]); + cmakeFlags = [ + "-DMorphIO_CXX_WARNINGS=OFF" + ]; + postInstall = '' + mkdir -p $out/${final-py.python.sitePackages} + mv ../morphio $out/${final-py.python.sitePackages} + cp binds/python/_morphio.* $out/${final-py.python.sitePackages}/morphio/ + ''; + }); + + csa = final-py.buildPythonPackage rec { + pname = "csa"; + version = "0.1.12"; + + src = final.fetchFromGitHub { + owner = "INCF"; + repo = "csa"; + rev = "v${version}"; + hash = "sha256-QtgqpYD0PtMoiobCEe0SkKF6HiiypctOWht9EnhlhKM="; + }; + + propagatedBuildInputs = with final-py; [ + numpy + matplotlib + ]; + }; + + nineml = final-py.buildPythonPackage rec { + pname = "nineml"; + version = "25-04-2020"; + + src = final.fetchFromGitHub { + owner = "INCF"; + repo = "nineml-python"; + rev = "062a2ac8a9be97cee4dad02938e3858e051cf07c"; + hash = "sha256-Tyil4lnqQlzQthp6L77+pAjDywHDQC3NIp39BRgIfzY="; + }; + + postPatch = '' + sed -e 's/collections.Iterable/collections.abc.Iterable/g' -i nineml/utils/iterables.py + sed -e 's/sympy.numbers/sympy.core.numbers/g' -i nineml/abstraction/componentclass/visitors/validators/general.py + ''; + + buildInputs = with final-py; [ + pip + ]; + + propagatedBuildInputs = with final-py; [ + lxml + pyyaml + h5py + future + sympy + numpy + numpydoc + nose + ]; + }; + + lazyarray = final-py.buildPythonPackage rec { + pname = "lazyarray"; + version = "0.5.2"; + + src = final.fetchFromGitHub { + owner = "NeuralEnsemble"; + repo = "lazyarray"; + rev = "9d60f2c307a70d7bd65fbfe3cb2a96391fd88bf9"; + hash = "sha256-D4KzICEdCoA1S8uKRU76Q6PfcolbuZsLAtDIm4a94wo="; + }; + + doCheck = false; # Py2 code + + propagatedBuildInputs = with final-py; [ + numpy + ]; + }; + + pynn = final-py.buildPythonPackage rec { + pname = "pyNN"; + version = "0.12.1"; + + src = final.fetchFromGitHub { + owner = "NeuralEnsemble"; + repo = "PyNN"; + rev = "${version}"; + hash = "sha256-X7U4aSA6J45++2mTPGWi+N6QtuH0muQtSrH6CWziNJg="; + }; + + buildInputs = with final-py; [ + pip + ]; + + propagatedBuildInputs = with final-py; [ + nineml + numpy + lazyarray + neo + quantities + morphio + brian2 + nest + neuronpy + ]; + + doCheck = false; + }; + + boilerplates = final-py.buildPythonPackage rec { + pname = "boilerplates"; + version = "1.1.1"; + + src = final.fetchFromGitHub { + owner = "mbdevpl"; + repo = "python-boilerplates"; + rev = "v${version}"; + hash = "sha256-u6Gdtgqo4s40vMZhgEonil7OWsbOSFbnBO2PgOzWXmY="; + }; + + # Fix circular dependency + postPatch = '' + echo "" > ./requirements.txt + echo 'VERSION = "${version}"' > ./boilerplates/_version.py + ''; + + disabledTests = [ + "test_git_repo" + "test_logging" + ]; + + nativeBuildInputs = with final-py; [ + pytestCheckHook + ]; + + propagatedBuildInputs = with final-py; [ + colorlog + sentry-sdk + executing + pure-eval + asttokens + argcomplete + GitPython + packaging + semver + docutils + ]; + }; + + version-query = final-py.buildPythonPackage rec { + pname = "version-query"; + version = "1.5.5"; + src = final.fetchFromGitHub { + owner = "mbdevpl"; + repo = "version-query"; + rev = "v${version}"; + hash = "sha256-b5G1YwT3RSWusNsT4kq8aBCzzs0UfoJrPMUH8KuaqX0="; + }; + + postPatch = '' + echo 'VERSION = "${version}"' > ./version_query/_version.py + ''; + + doCheck = false; + + propagatedBuildInputs = with final-py; [ + boilerplates + ]; + }; + + ebrains-drive = final-py.buildPythonPackage rec { + pname = "ebrains-drive"; + version = "20-02-2024"; + src = final.fetchFromGitHub { + owner = "HumanBrainProject"; + repo = "ebrains-drive"; + rev = "3be240da78b23488cf01dc9768423bb962673c8d"; + hash = "sha256-eYbAHGu0h9K5FYos10GGUwSMdDgVcslz2wf6XFY5yjo="; + }; + + postPatch = '' + sed -e 's/__version__ = predict_version_str()/__version__ = "0.6.0"/g' -i setup.py + ''; + + # no more strings.lowercase + doCheck = false; + + propagatedBuildInputs = with final-py; [ + version-query + requests + tqdm + ]; + }; + + SpiNNUtilities = final-py.buildPythonPackage { + pname = "SpiNNUtilities"; + version = "1!7.1.1"; + src = final.fetchFromGitHub { + owner = "SpiNNakerManchester"; + repo = "SpiNNUtils"; + rev = "37beeec7ad5489af8e644dfdf511108f27146951"; + hash = "sha256-oB3uxDTX7CFvftqDxYqJ0A4RLfK4/JH1FVoAJMcUEa4="; + }; + + # Tests depend on writable home + postPatch = '' + mkdir $NIX_BUILD_TOP/fake_home + export HOME=$NIX_BUILD_TOP/fake_home + export SKIP_PING_TESTS="true" + ''; + + nativeBuildInputs = with final-py; [ + pytestCheckHook + ]; + + disabledTests = [ + "test_localhost" + ]; + + buildInputs = with final-py; [ + httpretty + testfixtures + ]; + + propagatedBuildInputs = with final-py; [ + appdirs + numpy + pyyaml + requests + typing-extensions + ]; + }; + + SpiNNMachine = final-py.buildPythonPackage { + pname = "SpiNNMachine"; + version = "1!7.1.1"; + src = final.fetchFromGitHub { + owner = "SpiNNakerManchester"; + repo = "SpiNNMachine"; + rev = "a798e7b12200d66f6fb9c6ed0af3f0fa85abd7be"; + hash = "sha256-+9/ZK72SgI3seSCwCBVMPP1VL6r83SkQ4n3S1WkVCac="; + }; + + nativeBuildInputs = with final-py; [ + pytestCheckHook + ]; + + buildInputs = with final-py; [ + testfixtures + ]; + + propagatedBuildInputs = with final-py; [ + SpiNNUtilities + ]; + }; + + SpiNNaker_PACMAN = final-py.buildPythonPackage { + pname = "SpiNNaker_PACMAN"; + version = "1!7.1.1"; + src = final.fetchFromGitHub { + owner = "SpiNNakerManchester"; + repo = "PACMAN"; + rev = "adc5ed196b8ac661365c5ec67b4107932548deab"; + hash = "sha256-ITe0fqDg/4r1xwFYXHpl0kL0Ek3d2s+SbQvRtWk1eF4="; + }; + + nativeBuildInputs = with final-py; [ + pytestCheckHook + ]; + + buildInputs = with final-py; [ + testfixtures + ]; + + propagatedBuildInputs = with final-py; [ + SpiNNMachine + jsonschema + ]; + }; + + SpiNNMan = final-py.buildPythonPackage { + pname = "SpiNNMan"; + version = "1!7.1.1"; + src = final.fetchFromGitHub { + owner = "SpiNNakerManchester"; + repo = "SpiNNMan"; + rev = "8b0e8192125c5856769ff302480e2c17b08d1b5f"; + hash = "sha256-54JE5Vl1mcdBCHR4HOk4l7muZHePvufrwhgJZ11aX2A="; + }; + + nativeBuildInputs = with final-py; [ + pytestCheckHook + ]; + + buildInputs = with final-py; [ + testfixtures + ]; + + disabledTests = [ + "test_create_job" + ]; + + propagatedBuildInputs = with final-py; [ + SpiNNMachine + SpiNNUtilities + websocket-client + ]; + }; + + spalloc = final-py.buildPythonPackage { + pname = "spalloc"; + version = "1!7.1.1"; + src = final.fetchFromGitHub { + owner = "SpiNNakerManchester"; + repo = "spalloc"; + rev = "25f5d0874269996f2c36175885e9bbe7895ed4af"; + hash = "sha256-Tck2VGV5ZO1PKHEY/OLoIVvj5AWCyVqtXca514vWmTA="; + }; + + nativeBuildInputs = with final-py; [ + pytestCheckHook + ]; + + buildInputs = with final-py; [ + mock + ]; + + propagatedBuildInputs = with final-py; [ + SpiNNUtilities + jsonschema + ]; + }; + + spinnaker_tools = final.stdenv.mkDerivation { + pname = "spinnaker_tools"; + version = "1!7.1.1"; + src = final.fetchFromGitHub { + owner = "SpiNNakerManchester"; + repo = "spinnaker_tools"; + rev = "26dd8651d7af8371ca1d5927524d1af2527dd041"; + hash = "sha256-Ppow52pfzVi9Jh7cVSow6OmNMLmudMq4lRZOeCJyMU8="; + }; + propagatedBuildInputs = with final; [ + perl + gcc-arm-embedded-10 + ]; + postPatch = '' + patchShebangs ./tools + ''; + preConfigure = '' + export SPINN_DIRS=$PWD + export GNUTOOLS=${final.gcc-arm-embedded-10} + export GNUBIN=$GNUTOOLS/bin + chmod +x ./tools/* + ''; + installPhase = '' + mkdir $out + cp -r * $out + ''; + }; + + spinn_common = final.stdenv.mkDerivation { + pname = "spinn_common"; + version = "1!7.1.1"; + src = final.fetchFromGitHub { + owner = "SpiNNakerManchester"; + repo = "spinn_common"; + rev = "fa5f769a7e8bab42b6932557c0deaebc1d7f2016"; + hash = "sha256-aQpIkPWhKT+Uw4svKfibR7SEeKwNPqv86skSLNv2Z3Q="; + }; + nativeBuildInputs = [ + final-py.spinnaker_tools + ]; + preConfigure = '' + mkdir SPINN_DIRS + cp -r ${final-py.spinnaker_tools}/* SPINN_DIRS + chmod +rw -R SPINN_DIRS + export SPINN_DIRS=$PWD/SPINN_DIRS + export GNUTOOLS=${final.gcc-arm-embedded-10} + export GNUBIN=$GNUTOOLS/bin + ''; + + postInstall = '' + cp -r SPINN_DIRS $out + ''; + }; + + SpiNNFrontEndCommon = final-py.buildPythonPackage { + pname = "SpiNNFrontEndCommon"; + version = "1!7.1.1"; + src = SpiNNFrontEndCommon_C_Models; + + nativeBuildInputs = with final-py; [ + pytestCheckHook + ]; + + buildInputs = with final-py; [ + httpretty + testfixtures + ]; + + disabledTestPaths = [ + "fec_local_tests/test_java_caller.py" + "unittests/interface/test_java_caller.py" + ]; + + propagatedBuildInputs = with final-py; [ + ebrains-drive + scipy + SpiNNMan + SpiNNaker_PACMAN + spalloc + SpiNNFrontEndCommon_C_Models + ]; + }; + + spinnaker_testbase = final-py.buildPythonPackage { + pname = "spinnaker_testbase"; + version = "1!7.1.1"; + + src = final.fetchFromGitHub { + owner = "SpiNNakerManchester"; + repo = "TestBase"; + rev = "324aa4c9f8348aa21c88611bb7ccf7585c783415"; + hash = "sha256-YBDaFr7oDx53LBQN+V8CXpNTIGSLBDRyq4pNMBxankI="; + }; + + nativeBuildInputs = with final-py; [ + pytestCheckHook + ]; + + buildInputs = with final-py; [ + testfixtures + ]; + + propagatedBuildInputs = with final-py; [ + SpiNNFrontEndCommon + matplotlib + ]; + }; + + spynnaker = final-py.buildPythonPackage { + pname = "spynnaker"; + version = "1!7.1.1"; + + src = spynnaker_c; + + nativeBuildInputs = with final-py; [ + pytestCheckHook + ]; + + buildInputs = with final-py; [ + testfixtures + spinnaker_testbase + ]; + + propagatedBuildInputs = with final-py; [ + SpiNNFrontEndCommon + matplotlib + quantities + neo + lazyarray + scipy + csa + pynn + ]; + + # All these tests depend on connecting to the SpiNNaker or Network + disabledTestPaths = [ + "proxy_integration_tests/" + "spynnaker_integration_tests/" + "test_whole_board/" + "unittests/test_from_file_connector.py" + "unittests/model_tests/" + "unittests/test_using_virtual_board/" + "unittests/test_integration_using_virtual_board/" + "unittests/test_pop_views_assembly/test_getting.py" + "unittests/test_pop_views_assembly/test_idmixin.py" + "unittests/test_pop_views_assembly/test_models.py" + "unittests/test_pop_views_assembly/test_population.py" + "unittests/test_pop_views_assembly/test_record.py" + "unittests/test_pop_views_assembly/test_views.py" + "unittests/test_populations/test_population.py" + "unittests/test_sata_connectors/" + "unittests/test_spinnaker_link_connectors/" + "unittests/test_populations/test_vertex.py" + "unittests/utilities_tests/test_utility_calls.py" + ]; + }; +}