From b613464a62bafeaaab19f10a14f62a8019d85914 Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Mon, 3 Feb 2025 21:46:00 +0100 Subject: [PATCH 01/14] audible-cli: use `addBinToPathHook` --- pkgs/by-name/au/audible-cli/package.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkgs/by-name/au/audible-cli/package.nix b/pkgs/by-name/au/audible-cli/package.nix index 88a8bfd55c0d..4405384f234b 100644 --- a/pkgs/by-name/au/audible-cli/package.nix +++ b/pkgs/by-name/au/audible-cli/package.nix @@ -2,6 +2,7 @@ lib, python3Packages, fetchFromGitHub, + addBinToPathHook, installShellFiles, nix-update-script, }: @@ -24,6 +25,7 @@ python3Packages.buildPythonApplication rec { setuptools ] ++ [ + addBinToPathHook installShellFiles ]; @@ -46,7 +48,6 @@ python3Packages.buildPythonApplication rec { ]; postInstall = '' - export PATH=$out/bin:$PATH installShellCompletion --cmd audible \ --bash <(source utils/code_completion/audible-complete-bash.sh) \ --fish <(source utils/code_completion/audible-complete-zsh-fish.sh) \ From 6a79b58e8db5f9226a2c3d9cfcf2fb4867855679 Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Mon, 3 Feb 2025 22:11:35 +0100 Subject: [PATCH 02/14] python312Packages.eliot: unbreak, use `addBinToPathHook` --- pkgs/development/python-modules/eliot/default.nix | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/pkgs/development/python-modules/eliot/default.nix b/pkgs/development/python-modules/eliot/default.nix index acd7e0e368cf..2d5467cea9f8 100644 --- a/pkgs/development/python-modules/eliot/default.nix +++ b/pkgs/development/python-modules/eliot/default.nix @@ -15,6 +15,7 @@ zope-interface, daemontools, + addBinToPathHook, dask, distributed, hypothesis, @@ -38,14 +39,6 @@ buildPythonPackage rec { hash = "sha256-KqAXOMrRawzjpt5do2KdqpMMgpBtxeZ+X+th0WwBl+U="; }; - patches = [ - (fetchpatch2 { - name = "numpy2-compat.patch"; - url = "https://github.com/itamarst/eliot/commit/39eccdad44f91971ecf1211fb01366b4d9801817.patch"; - hash = "sha256-al6olmvFZ8pDblljWmWqs5QrtcuHKcea255XgG+1+1o="; - }) - ]; - build-system = [ setuptools ]; dependencies = [ @@ -56,6 +49,7 @@ buildPythonPackage rec { ]; nativeCheckInputs = [ + addBinToPathHook dask distributed hypothesis @@ -69,11 +63,6 @@ buildPythonPackage rec { pythonImportsCheck = [ "eliot" ]; - # Tests run eliot-prettyprint in out/bin. - preCheck = '' - export PATH=$out/bin:$PATH - ''; - disabledTests = [ # Fails since dask's bump to 2024.12.2 # Reported upstream: https://github.com/itamarst/eliot/issues/507 From df0dc1125db3ffa75eefd99c5ff2618bc53b63f8 Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Mon, 3 Feb 2025 22:14:42 +0100 Subject: [PATCH 03/14] eliot-tree: use `addBinToPathHook` --- pkgs/by-name/el/eliot-tree/package.nix | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/pkgs/by-name/el/eliot-tree/package.nix b/pkgs/by-name/el/eliot-tree/package.nix index 3a8c809f933c..637f4af95be0 100644 --- a/pkgs/by-name/el/eliot-tree/package.nix +++ b/pkgs/by-name/el/eliot-tree/package.nix @@ -2,6 +2,7 @@ lib, python3Packages, fetchPypi, + addBinToPathHook, }: python3Packages.buildPythonApplication rec { @@ -32,15 +33,11 @@ python3Packages.buildPythonApplication rec { ]; nativeCheckInputs = with python3Packages; [ + addBinToPathHook pytestCheckHook testtools ]; - # Tests run eliot-tree in out/bin. - preCheck = '' - export PATH=$out/bin:$PATH - ''; - pythonImportsCheck = [ "eliottree" ]; meta = { From fbac494ac20f64b97b80d92088eb22eb8588af75 Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Mon, 3 Feb 2025 22:15:08 +0100 Subject: [PATCH 04/14] flye: use `addBinToPathHook` --- pkgs/by-name/fl/flye/package.nix | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pkgs/by-name/fl/flye/package.nix b/pkgs/by-name/fl/flye/package.nix index 443c66488e23..1f7bde7a2aa5 100644 --- a/pkgs/by-name/fl/flye/package.nix +++ b/pkgs/by-name/fl/flye/package.nix @@ -8,6 +8,7 @@ libdeflate, bash, coreutils, + addBinToPathHook, }: python3Packages.buildPythonApplication rec { @@ -54,11 +55,10 @@ python3Packages.buildPythonApplication rec { pythonImportsCheck = [ "flye" ]; - nativeCheckInputs = [ python3Packages.pytestCheckHook ]; - - preCheck = '' - export PATH=$out/bin:$PATH - ''; + nativeCheckInputs = [ + addBinToPathHook + python3Packages.pytestCheckHook + ]; meta = with lib; { description = "De novo assembler for single molecule sequencing reads using repeat graphs"; From 90c2ed254ecdd580928108a5b4136040ef374883 Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Mon, 3 Feb 2025 22:15:33 +0100 Subject: [PATCH 05/14] gallia: use `addBinToPathHook` --- pkgs/by-name/ga/gallia/package.nix | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/pkgs/by-name/ga/gallia/package.nix b/pkgs/by-name/ga/gallia/package.nix index 0878b750a958..7268e0475165 100644 --- a/pkgs/by-name/ga/gallia/package.nix +++ b/pkgs/by-name/ga/gallia/package.nix @@ -3,6 +3,7 @@ fetchFromGitHub, python3, cacert, + addBinToPathHook, }: python3.pkgs.buildPythonApplication rec { @@ -43,17 +44,18 @@ python3.pkgs.buildPythonApplication rec { SSL_CERT_FILE = "${cacert}/etc/ssl/certs/ca-bundle.crt"; - nativeCheckInputs = with python3.pkgs; [ - pytestCheckHook - pytest-asyncio - ]; + nativeCheckInputs = + with python3.pkgs; + [ + pytestCheckHook + pytest-asyncio + ] + ++ [ + addBinToPathHook + ]; pythonImportsCheck = [ "gallia" ]; - preCheck = '' - export PATH=$out/bin:$PATH - ''; - meta = with lib; { description = "Extendable Pentesting Framework for the Automotive Domain"; homepage = "https://github.com/Fraunhofer-AISEC/gallia"; From b3bba66ff3c64871d6ff98b497aa8b9c04835449 Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Mon, 3 Feb 2025 22:15:53 +0100 Subject: [PATCH 06/14] gdtoolkit_3: use `addBinToPathHook`, use `writableTmpDirAsHomeHook` --- pkgs/by-name/gd/gdtoolkit_3/package.nix | 26 ++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/pkgs/by-name/gd/gdtoolkit_3/package.nix b/pkgs/by-name/gd/gdtoolkit_3/package.nix index a25eddbcac1b..8469a1a647d7 100644 --- a/pkgs/by-name/gd/gdtoolkit_3/package.nix +++ b/pkgs/by-name/gd/gdtoolkit_3/package.nix @@ -2,6 +2,8 @@ lib, python3, fetchFromGitHub, + addBinToPathHook, + writableTmpDirAsHomeHook, }: let @@ -31,7 +33,7 @@ python.pkgs.buildPythonApplication rec { src = fetchFromGitHub { owner = "Scony"; repo = "godot-gdscript-toolkit"; - rev = version; + tag = version; hash = "sha256-cMGD5Xdf9ElS1NT7Q0NPB//EvUO0MI0VTtps5JRisZ4="; }; @@ -46,18 +48,16 @@ python.pkgs.buildPythonApplication rec { doCheck = true; - nativeCheckInputs = with python.pkgs; [ - pytestCheckHook - hypothesis - ]; - - preCheck = '' - # The tests want to run the installed executables - export PATH=$out/bin:$PATH - - # gdtoolkit tries to write cache variables to $HOME/.cache - export HOME=$TMP - ''; + nativeCheckInputs = + with python.pkgs; + [ + pytestCheckHook + hypothesis + ] + ++ [ + addBinToPathHook + writableTmpDirAsHomeHook + ]; # The tests are not working on NixOS disabledTests = [ From 2f69f99ff8db14f549684d68ed0f80f66bfc9b3a Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Mon, 3 Feb 2025 22:17:27 +0100 Subject: [PATCH 07/14] gdtoolkit_4: use `addBinToPathHook`, use `writableTmpDirAsHomeHook` --- pkgs/by-name/gd/gdtoolkit_4/package.nix | 26 ++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/pkgs/by-name/gd/gdtoolkit_4/package.nix b/pkgs/by-name/gd/gdtoolkit_4/package.nix index 301f9013409e..3c51104343c8 100644 --- a/pkgs/by-name/gd/gdtoolkit_4/package.nix +++ b/pkgs/by-name/gd/gdtoolkit_4/package.nix @@ -2,6 +2,8 @@ lib, python3, fetchFromGitHub, + addBinToPathHook, + writableTmpDirAsHomeHook, }: let @@ -30,7 +32,7 @@ python.pkgs.buildPythonApplication rec { src = fetchFromGitHub { owner = "Scony"; repo = "godot-gdscript-toolkit"; - rev = version; + tag = version; hash = "sha256-XK6s/WnbTzjCAtV8dbRPLe5olpKUglPLQdttRRMvX70="; }; @@ -45,18 +47,16 @@ python.pkgs.buildPythonApplication rec { doCheck = true; - nativeCheckInputs = with python.pkgs; [ - pytestCheckHook - hypothesis - ]; - - preCheck = '' - # The tests want to run the installed executables - export PATH=$out/bin:$PATH - - # gdtoolkit tries to write cache variables to $HOME/.cache - export HOME=$TMP - ''; + nativeCheckInputs = + with python.pkgs; + [ + pytestCheckHook + hypothesis + ] + ++ [ + addBinToPathHook + writableTmpDirAsHomeHook + ]; # The tests are not working on NixOS disabledTestPaths = [ From f0ad956733c49080da0d1ad33198aab6f0842c49 Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Mon, 3 Feb 2025 22:17:58 +0100 Subject: [PATCH 08/14] gemmi: use `addBinToPathHook` --- pkgs/by-name/ge/gemmi/package.nix | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/pkgs/by-name/ge/gemmi/package.nix b/pkgs/by-name/ge/gemmi/package.nix index 4082147ec513..17e4cebd94eb 100644 --- a/pkgs/by-name/ge/gemmi/package.nix +++ b/pkgs/by-name/ge/gemmi/package.nix @@ -5,6 +5,7 @@ cmake, zlib, enablePython ? true, + addBinToPathHook, python3Packages, testers, }: @@ -44,15 +45,16 @@ stdenv.mkDerivation (finalAttrs: { doInstallCheck = enablePython; - nativeInstallCheckInputs = with python3Packages; [ - # biopython - numpy - pytestCheckHook - ]; - - preInstallCheck = '' - export PATH=$out/bin:$PATH - ''; + nativeInstallCheckInputs = + with python3Packages; + [ + # biopython + numpy + pytestCheckHook + ] + ++ [ + addBinToPathHook + ]; pytestFlagsArray = [ "../tests" ]; From 2964352875f76ece5ec973b89812e0d549797177 Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Mon, 3 Feb 2025 22:18:21 +0100 Subject: [PATCH 09/14] multiqc: use `addBinToPathHook` --- pkgs/by-name/mu/multiqc/package.nix | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/pkgs/by-name/mu/multiqc/package.nix b/pkgs/by-name/mu/multiqc/package.nix index be3f8ad6ea86..6d49ccda1d43 100644 --- a/pkgs/by-name/mu/multiqc/package.nix +++ b/pkgs/by-name/mu/multiqc/package.nix @@ -5,6 +5,7 @@ procps, stdenv, versionCheckHook, + addBinToPathHook, }: python3Packages.buildPythonApplication rec { @@ -77,19 +78,23 @@ python3Packages.buildPythonApplication rec { preCheck = '' chmod -R u+w ../test-data ln -s ../test-data . - export PATH=$out/bin:$PATH ''; # Some tests run subprocess.run() with "ps" - nativeCheckInputs = with python3Packages; [ - procps - pytest-cov - pytest-xdist - pytestCheckHook - syrupy - pygithub - versionCheckHook - ]; + nativeCheckInputs = + with python3Packages; + [ + procps + pytest-cov + pytest-xdist + pytestCheckHook + syrupy + pygithub + versionCheckHook + ] + ++ [ + addBinToPathHook + ]; versionCheckProgramArg = [ "--version" ]; From 11613c422cf952ec67adf32c2265790f633f6365 Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Mon, 3 Feb 2025 22:18:39 +0100 Subject: [PATCH 10/14] parquet-tools: use `addBinToPathHook` --- pkgs/by-name/pa/parquet-tools/package.nix | 31 +++++++++++------------ 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/pkgs/by-name/pa/parquet-tools/package.nix b/pkgs/by-name/pa/parquet-tools/package.nix index df25bfd14705..92771bad07f5 100644 --- a/pkgs/by-name/pa/parquet-tools/package.nix +++ b/pkgs/by-name/pa/parquet-tools/package.nix @@ -2,11 +2,10 @@ lib, fetchFromGitHub, python3Packages, + addBinToPathHook, }: -with python3Packages; - -buildPythonApplication rec { +python3Packages.buildPythonApplication rec { pname = "parquet-tools"; version = "0.2.16"; @@ -27,7 +26,7 @@ buildPythonApplication rec { postPatch = '' substituteInPlace tests/test_inspect.py \ - --replace "parquet-cpp-arrow version 5.0.0" "parquet-cpp-arrow version ${pyarrow.version}" \ + --replace "parquet-cpp-arrow version 5.0.0" "parquet-cpp-arrow version ${python3Packages.pyarrow.version}" \ --replace "serialized_size: 2222" "serialized_size: 2221" \ --replace "format_version: 1.0" "format_version: 2.6" ''; @@ -38,11 +37,11 @@ buildPythonApplication rec { "thrift" ]; - nativeBuildInputs = [ + nativeBuildInputs = with python3Packages; [ poetry-core ]; - propagatedBuildInputs = [ + propagatedBuildInputs = with python3Packages; [ boto3 colorama halo @@ -52,16 +51,16 @@ buildPythonApplication rec { thrift ]; - # TestGetMetaData.test_inspect shells out to `parquet-tools` CLI entrypoint - preCheck = '' - export PATH=$out/bin:$PATH - ''; - - nativeCheckInputs = [ - moto - pytest-mock - pytestCheckHook - ]; + nativeCheckInputs = + with python3Packages; + [ + moto + pytest-mock + pytestCheckHook + ] + ++ [ + addBinToPathHook + ]; disabledTests = [ # test file is 2 bytes bigger than expected From a8ad6d2988b99d8f82723a6df89a972a03ee84d9 Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Mon, 3 Feb 2025 22:19:38 +0100 Subject: [PATCH 11/14] pifpaf: use `addBinToPathHook` --- pkgs/by-name/pi/pifpaf/package.nix | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/pkgs/by-name/pi/pifpaf/package.nix b/pkgs/by-name/pi/pifpaf/package.nix index 18bdd1d2fa73..232a6bde2871 100644 --- a/pkgs/by-name/pi/pifpaf/package.nix +++ b/pkgs/by-name/pi/pifpaf/package.nix @@ -1,10 +1,11 @@ { lib, - python3, + python3Packages, fetchPypi, + addBinToPathHook, }: -python3.pkgs.buildPythonApplication rec { +python3Packages.buildPythonApplication rec { pname = "pifpaf"; version = "3.2.3"; format = "setuptools"; @@ -14,7 +15,7 @@ python3.pkgs.buildPythonApplication rec { hash = "sha256-L039ZAFnYLCU52h1SczJU0T7+1gufxQlVzQr1EPCqc8="; }; - propagatedBuildInputs = with python3.pkgs; [ + propagatedBuildInputs = with python3Packages; [ click daiquiri fixtures @@ -24,14 +25,15 @@ python3.pkgs.buildPythonApplication rec { xattr ]; - preCheck = '' - export PATH=$out/bin:$PATH - ''; - - nativeCheckInputs = with python3.pkgs; [ - requests - testtools - ]; + nativeCheckInputs = + with python3Packages; + [ + requests + testtools + ] + ++ [ + addBinToPathHook + ]; pythonImportsCheck = [ "pifpaf" ]; From b5279fcbed3f27ef0961792f5ac804a93051476b Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Mon, 3 Feb 2025 22:19:57 +0100 Subject: [PATCH 12/14] tts: use `addBinToPathHook`, use `writableTmpDirAsHomeHook` --- pkgs/by-name/tt/tts/package.nix | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/pkgs/by-name/tt/tts/package.nix b/pkgs/by-name/tt/tts/package.nix index 26ad68675736..f4ce01fe7cdc 100644 --- a/pkgs/by-name/tt/tts/package.nix +++ b/pkgs/by-name/tt/tts/package.nix @@ -4,6 +4,8 @@ fetchFromGitHub, espeak-ng, tts, + addBinToPathHook, + writableTmpDirAsHomeHook, }: let @@ -111,18 +113,20 @@ python.pkgs.buildPythonApplication rec { doCheck = true; }); - nativeCheckInputs = with python.pkgs; [ - espeak-ng - pytestCheckHook - ]; + nativeCheckInputs = + with python.pkgs; + [ + espeak-ng + pytestCheckHook + ] + ++ [ + addBinToPathHook + writableTmpDirAsHomeHook + ]; preCheck = '' # use the installed TTS in $PYTHONPATH instead of the one from source to also have cython modules. mv TTS{,.old} - export PATH=$out/bin:$PATH - - # numba tries to write to HOME directory - export HOME=$TMPDIR for file in $(grep -rl 'python TTS/bin' tests); do substituteInPlace "$file" \ From b092a528f30f25e78acfa9dc459912bb8c8ca41f Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Mon, 3 Feb 2025 22:20:19 +0100 Subject: [PATCH 13/14] xonsh: use `addBinToPathHook` --- pkgs/by-name/xo/xonsh/unwrapped.nix | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/pkgs/by-name/xo/xonsh/unwrapped.nix b/pkgs/by-name/xo/xonsh/unwrapped.nix index 93544f928fd6..3992262d873c 100644 --- a/pkgs/by-name/xo/xonsh/unwrapped.nix +++ b/pkgs/by-name/xo/xonsh/unwrapped.nix @@ -2,10 +2,12 @@ lib, coreutils, fetchFromGitHub, - git, + gitMinimal, glibcLocales, nix-update-script, pythonPackages, + addBinToPathHook, + writableTmpDirAsHomeHook, }: let @@ -19,7 +21,7 @@ let src = fetchFromGitHub { owner = "xonsh"; repo = "xonsh"; - rev = "refs/tags/${argset.version}"; + tag = argset.version; hash = "sha256-20egNKlJjJO1wdy1anApz0ADBnaHPUSqhfrsPe3QQIs="; }; @@ -39,8 +41,10 @@ let nativeCheckInputs = [ - git + addBinToPathHook + gitMinimal glibcLocales + writableTmpDirAsHomeHook ] ++ (with pythonPackages; [ pip @@ -77,6 +81,9 @@ let # https://github.com/xonsh/xonsh/issues/5569 "test_spec_decorator_alias_output_format" + + # Broken test + "test_repath_backslash" ]; disabledTestPaths = [ @@ -103,11 +110,6 @@ let patchShebangs . ''; - preCheck = '' - export HOME=$TMPDIR - export PATH=$out/bin:$PATH - ''; - passthru = { shellPath = "/bin/xonsh"; python = pythonPackages.python; # To the wrapper From 2a5c17865a9c6481ccddb7d673d483e1793ce3ee Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Mon, 3 Feb 2025 22:20:36 +0100 Subject: [PATCH 14/14] zxpy: use `addBinToPathHook` --- pkgs/by-name/zx/zxpy/package.nix | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/pkgs/by-name/zx/zxpy/package.nix b/pkgs/by-name/zx/zxpy/package.nix index 070c0d22ca25..f107171d1185 100644 --- a/pkgs/by-name/zx/zxpy/package.nix +++ b/pkgs/by-name/zx/zxpy/package.nix @@ -1,10 +1,12 @@ { lib, - python3, + python3Packages, fetchFromGitHub, deterministic-uname, + addBinToPathHook, }: -python3.pkgs.buildPythonApplication rec { + +python3Packages.buildPythonApplication rec { pname = "zxpy"; version = "1.6.4"; pyproject = true; @@ -16,18 +18,19 @@ python3.pkgs.buildPythonApplication rec { hash = "sha256-/VITHN517lPUmhLYgJHBYYvvlJdGg2Hhnwk47Mp9uc0="; }; - build-system = [ - python3.pkgs.setuptools + build-system = with python3Packages; [ + setuptools ]; - nativeCheckInputs = [ - deterministic-uname - python3.pkgs.pytestCheckHook - ]; - - preCheck = '' - export PATH=$out/bin:$PATH - ''; + nativeCheckInputs = + with python3Packages; + [ + deterministic-uname + pytestCheckHook + ] + ++ [ + addBinToPathHook + ]; pythonImportsCheck = [ "zx" ];