From c6b15e1db9ebefd385e058cdb6afbd596ed9c6e5 Mon Sep 17 00:00:00 2001 From: mivorasu <221005165+mivorasu@users.noreply.github.com> Date: Mon, 28 Jul 2025 04:12:58 +0000 Subject: [PATCH] treewide: fix mismatched runHook invocations in Phase --- pkgs/applications/editors/jetbrains/source/build.nix | 4 ++-- .../editors/jupyter-kernels/xeus-cling/default.nix | 4 ++-- pkgs/by-name/bo/bobcat/package.nix | 4 ++-- pkgs/by-name/cc/cc1541/package.nix | 4 +++- pkgs/by-name/db/dbip-city-lite/package.nix | 4 ++-- pkgs/by-name/db/dbip-country-lite/package.nix | 4 ++-- pkgs/by-name/dh/dhcpdump/package.nix | 4 ++-- pkgs/by-name/di/discord-sh/package.nix | 6 ++++-- pkgs/by-name/du/duckstation/package.nix | 4 ++-- pkgs/by-name/ed/edmarketconnector/package.nix | 4 ++-- pkgs/by-name/he/hello-wayland/package.nix | 4 ++-- pkgs/by-name/li/libblocksruntime/package.nix | 2 +- pkgs/by-name/mo/mongoose/package.nix | 4 ++-- pkgs/by-name/qu/quiet/package.nix | 4 ++-- pkgs/by-name/ra/raylib-games/package.nix | 4 ++-- pkgs/by-name/si/simple64/package.nix | 4 ++-- pkgs/by-name/sw/switchres/package.nix | 4 ++-- pkgs/development/compilers/factor-lang/wrapper.nix | 6 ++++-- .../tools/build-managers/bazel/bazel_5/default.nix | 6 +++++- .../tools/build-managers/bazel/bazel_6/default.nix | 6 +++++- .../tools/build-managers/bazel/bazel_7/default.nix | 6 +++++- 21 files changed, 55 insertions(+), 37 deletions(-) diff --git a/pkgs/applications/editors/jetbrains/source/build.nix b/pkgs/applications/editors/jetbrains/source/build.nix index 290c30181bef..ecf8de4257b0 100644 --- a/pkgs/applications/editors/jetbrains/source/build.nix +++ b/pkgs/applications/editors/jetbrains/source/build.nix @@ -162,11 +162,11 @@ let patches = [ ../patches/kotlinc-path.patch ]; postPatch = "sed -i 's|KOTLIN_PATH_HERE|${kotlin'}|' src/main/java/org/jetbrains/jpsBootstrap/KotlinCompiler.kt"; buildPhase = '' - runHook preInstall + runHook preBuild ant -Duser.home=${jpsRepo} -Dbuild.dir=/build/out -f jps-bootstrap-classpath.xml - runHook postInstall + runHook postBuild ''; installPhase = '' runHook preInstall diff --git a/pkgs/applications/editors/jupyter-kernels/xeus-cling/default.nix b/pkgs/applications/editors/jupyter-kernels/xeus-cling/default.nix index b92bb3ff3ce1..74c666803f24 100644 --- a/pkgs/applications/editors/jupyter-kernels/xeus-cling/default.nix +++ b/pkgs/applications/editors/jupyter-kernels/xeus-cling/default.nix @@ -42,7 +42,7 @@ let doInstallCheck = true; installCheckPhase = '' - runHook preCheck + runHook preInstallCheck # Smoke check: run a test notebook using Papermill by creating a simple kernelspec mkdir -p kernels/cpp17 @@ -61,7 +61,7 @@ let exit 1 fi - runHook postCheck + runHook postInstallCheck ''; passthru = (oldAttrs.passthru or { }) // { diff --git a/pkgs/by-name/bo/bobcat/package.nix b/pkgs/by-name/bo/bobcat/package.nix index 51423f2f38bf..9004282553b5 100644 --- a/pkgs/by-name/bo/bobcat/package.nix +++ b/pkgs/by-name/bo/bobcat/package.nix @@ -57,11 +57,11 @@ stdenv.mkDerivation rec { ''; installPhase = '' - runHook preBuild + runHook preInstall ./build install x - runHook postBuild + runHook postInstall ''; meta = with lib; { diff --git a/pkgs/by-name/cc/cc1541/package.nix b/pkgs/by-name/cc/cc1541/package.nix index 6489822249a3..cc2546987b65 100644 --- a/pkgs/by-name/cc/cc1541/package.nix +++ b/pkgs/by-name/cc/cc1541/package.nix @@ -25,9 +25,11 @@ stdenv.mkDerivation (finalAttrs: { doInstallCheck = true; - installCheckPhase = '' + checkPhase = '' runHook preCheck + make test + runHook postCheck ''; diff --git a/pkgs/by-name/db/dbip-city-lite/package.nix b/pkgs/by-name/db/dbip-city-lite/package.nix index fc49f52d647b..a134747267a5 100644 --- a/pkgs/by-name/db/dbip-city-lite/package.nix +++ b/pkgs/by-name/db/dbip-city-lite/package.nix @@ -15,12 +15,12 @@ stdenvNoCC.mkDerivation (finalAttrs: { dontUnpack = true; installPhase = '' - runHook preBuild + runHook preInstall gzip -c -d "$src" > dbip-city-lite.mmdb install -Dm444 dbip-city-lite.mmdb "$out/share/dbip/dbip-city-lite.mmdb" - runHook postBuild + runHook postInstall ''; passthru.mmdb = "${finalAttrs.finalPackage}/share/dbip/dbip-city-lite.mmdb"; diff --git a/pkgs/by-name/db/dbip-country-lite/package.nix b/pkgs/by-name/db/dbip-country-lite/package.nix index b6383b60b55f..89efe45b4783 100644 --- a/pkgs/by-name/db/dbip-country-lite/package.nix +++ b/pkgs/by-name/db/dbip-country-lite/package.nix @@ -15,12 +15,12 @@ stdenvNoCC.mkDerivation (finalAttrs: { dontUnpack = true; installPhase = '' - runHook preBuild + runHook preInstall gzip -c -d "$src" > dbip-country-lite.mmdb install -Dm444 dbip-country-lite.mmdb "$out/share/dbip/dbip-country-lite.mmdb" - runHook postBuild + runHook postInstall ''; passthru.mmdb = "${finalAttrs.finalPackage}/share/dbip/dbip-country-lite.mmdb"; diff --git a/pkgs/by-name/dh/dhcpdump/package.nix b/pkgs/by-name/dh/dhcpdump/package.nix index 9505f5d74631..21ce06a7373d 100644 --- a/pkgs/by-name/dh/dhcpdump/package.nix +++ b/pkgs/by-name/dh/dhcpdump/package.nix @@ -30,12 +30,12 @@ stdenv.mkDerivation rec { ]; installPhase = '' - runHook preBuild + runHook preInstall install -Dm555 dhcpdump "$out/bin/dhcpdump" installManPage dhcpdump.8 - runHook postBuild + runHook postInstall ''; meta = { diff --git a/pkgs/by-name/di/discord-sh/package.nix b/pkgs/by-name/di/discord-sh/package.nix index 7276a9529d3b..d82db4afa9d3 100644 --- a/pkgs/by-name/di/discord-sh/package.nix +++ b/pkgs/by-name/di/discord-sh/package.nix @@ -36,9 +36,11 @@ stdenvNoCC.mkDerivation rec { doInstallCheck = true; installCheckPhase = '' - runHook preCheck + runHook preInstallCheck + $out/bin/discord.sh --help - runHook postCheck + + runHook postInstallCheck ''; installPhase = '' diff --git a/pkgs/by-name/du/duckstation/package.nix b/pkgs/by-name/du/duckstation/package.nix index a94fc06e1161..c84a3cdf5a0f 100644 --- a/pkgs/by-name/du/duckstation/package.nix +++ b/pkgs/by-name/du/duckstation/package.nix @@ -93,11 +93,11 @@ llvmPackages.stdenv.mkDerivation (finalAttrs: { env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.hostPlatform.isAarch64 "-flax-vector-conversions"; installCheckPhase = '' - runHook preCheck + runHook preInstallCheck $out/share/duckstation/common-tests - runHook postCheck + runHook postInstallCheck ''; installPhase = '' diff --git a/pkgs/by-name/ed/edmarketconnector/package.nix b/pkgs/by-name/ed/edmarketconnector/package.nix index 973ff3f43174..42ede9a40756 100644 --- a/pkgs/by-name/ed/edmarketconnector/package.nix +++ b/pkgs/by-name/ed/edmarketconnector/package.nix @@ -36,7 +36,7 @@ stdenv.mkDerivation (finalAttrs: { nativeBuildInputs = [ makeWrapper ]; installPhase = '' - runHook preInstallPhase + runHook preInstall mkdir -p $out/share/icons/hicolor/512x512/apps/ ln -s ${finalAttrs.src}/io.edcd.EDMarketConnector.png $out/share/icons/hicolor/512x512/apps/io.edcd.EDMarketConnector.png @@ -47,7 +47,7 @@ stdenv.mkDerivation (finalAttrs: { makeWrapper ${pythonEnv}/bin/python $out/bin/edmarketconnector \ --add-flags "${finalAttrs.src}/EDMarketConnector.py $@" - runHook postInstallPhase + runHook postInstall ''; meta = { diff --git a/pkgs/by-name/he/hello-wayland/package.nix b/pkgs/by-name/he/hello-wayland/package.nix index d4f98aee6465..d128ffd4bae8 100644 --- a/pkgs/by-name/he/hello-wayland/package.nix +++ b/pkgs/by-name/he/hello-wayland/package.nix @@ -34,10 +34,10 @@ stdenv.mkDerivation { ]; installPhase = '' - runHook preBuild + runHook preInstall mkdir -p $out/bin install hello-wayland $out/bin - runHook postBuild + runHook postInstall ''; passthru.updateScript = unstableGitUpdater { }; diff --git a/pkgs/by-name/li/libblocksruntime/package.nix b/pkgs/by-name/li/libblocksruntime/package.nix index b9551a90da7e..f54f190c9042 100644 --- a/pkgs/by-name/li/libblocksruntime/package.nix +++ b/pkgs/by-name/li/libblocksruntime/package.nix @@ -32,7 +32,7 @@ stdenv.mkDerivation { checkPhase = '' runHook preCheck ./checktests - runHook postChck + runHook postCheck ''; doCheck = false; # hasdescriptor.c test fails, hrm. diff --git a/pkgs/by-name/mo/mongoose/package.nix b/pkgs/by-name/mo/mongoose/package.nix index 6acdfe34a21a..d522cda6186d 100644 --- a/pkgs/by-name/mo/mongoose/package.nix +++ b/pkgs/by-name/mo/mongoose/package.nix @@ -46,13 +46,13 @@ stdenv.mkDerivation { ]; buildPhase = '' - runHook preConfigure + runHook preBuild for f in SuiteSparse_config Mongoose; do (cd $f && cmakeConfigurePhase && make -j$NIX_BUILD_CORES) done - runHook postConfigure + runHook postBuild ''; installPhase = '' diff --git a/pkgs/by-name/qu/quiet/package.nix b/pkgs/by-name/qu/quiet/package.nix index a253ff36d3e8..44e661d7c1c9 100644 --- a/pkgs/by-name/qu/quiet/package.nix +++ b/pkgs/by-name/qu/quiet/package.nix @@ -56,13 +56,13 @@ let ''; installPhase = '' - runHook preInstallPhase + runHook preInstall mkdir -p $out/{Applications,bin} mv Quiet.app $out/Applications makeWrapper $out/Applications/Quiet.app/Contents/MacOS/Quiet $out/bin/${pname} - runHook postInstallPhase + runHook postInstall ''; meta = meta // { diff --git a/pkgs/by-name/ra/raylib-games/package.nix b/pkgs/by-name/ra/raylib-games/package.nix index ae9eb728fb2f..6e282a2089d0 100644 --- a/pkgs/by-name/ra/raylib-games/package.nix +++ b/pkgs/by-name/ra/raylib-games/package.nix @@ -41,7 +41,7 @@ stdenv.mkDerivation { ''; installPhase = '' - runHook preBuild + runHook preInstall mkdir -p $out/bin $out/resources find . -type f -executable -exec cp {} $out/bin \; for d in *; do @@ -49,7 +49,7 @@ stdenv.mkDerivation { cp -ar "$d/src/resources" "$out/resources/$d" fi done - runHook postBuild + runHook postInstall ''; meta = with lib; { diff --git a/pkgs/by-name/si/simple64/package.nix b/pkgs/by-name/si/simple64/package.nix index b593ec22dcc1..49457d450826 100644 --- a/pkgs/by-name/si/simple64/package.nix +++ b/pkgs/by-name/si/simple64/package.nix @@ -72,11 +72,11 @@ stdenv.mkDerivation (finalAttrs: { dontUseCmakeConfigure = true; buildPhase = '' - runHook preInstall + runHook preBuild sh build.sh - runHook postInstall + runHook postBuild ''; installPhase = '' diff --git a/pkgs/by-name/sw/switchres/package.nix b/pkgs/by-name/sw/switchres/package.nix index 9457b0f2a069..ae5937fb3b4d 100644 --- a/pkgs/by-name/sw/switchres/package.nix +++ b/pkgs/by-name/sw/switchres/package.nix @@ -31,7 +31,7 @@ stdenv.mkDerivation (finalAttrs: { ]; patchPhase = '' - runHook preHook + runHook prePatch substituteInPlace ./custom_video_xrandr.cpp \ --replace-fail libX11.so ${xorg.libX11}/lib/libX11.so \ @@ -40,7 +40,7 @@ stdenv.mkDerivation (finalAttrs: { substituteInPlace ./custom_video_drmkms.cpp \ --replace-fail libdrm.so ${libdrm}/lib/libdrm.so \ - runHook postHook + runHook postPatch ''; env = { diff --git a/pkgs/development/compilers/factor-lang/wrapper.nix b/pkgs/development/compilers/factor-lang/wrapper.nix index f0cb45c454ad..4b6e32fddd9d 100644 --- a/pkgs/development/compilers/factor-lang/wrapper.nix +++ b/pkgs/development/compilers/factor-lang/wrapper.nix @@ -153,7 +153,8 @@ stdenv.mkDerivation (finalAttrs: { "io.sockets.secure.unix" ]; installCheckPhase = '' - runHook preCheck + runHook preInstallCheck + export HOME=$TMPDIR $out/bin/factor -e='USING: tools.test tools.test.private zealot.factor sequences namespaces formatting ; @@ -162,7 +163,8 @@ stdenv.mkDerivation (finalAttrs: { "compiler" suffix [ test-vocab ] each :test-failures test-failures get length "Number of failed tests: %d\n" printf' - runHook postCheck + + runHook postInstallCheck ''; passthru = { diff --git a/pkgs/development/tools/build-managers/bazel/bazel_5/default.nix b/pkgs/development/tools/build-managers/bazel/bazel_5/default.nix index 65d9697249f8..de35cd433d58 100644 --- a/pkgs/development/tools/build-managers/bazel/bazel_5/default.nix +++ b/pkgs/development/tools/build-managers/bazel/bazel_5/default.nix @@ -699,12 +699,16 @@ stdenv.mkDerivation rec { installShellCompletion --fish \ --name bazel.fish \ ./bazel_src/output/bazel-complete.fish + + runHook postInstall ''; # Install check fails on `aarch64-darwin` # https://github.com/NixOS/nixpkgs/issues/145587 doInstallCheck = stdenv.hostPlatform.system != "aarch64-darwin"; installCheckPhase = '' + runHook preInstallCheck + export TEST_TMPDIR=$(pwd) hello_test () { @@ -737,7 +741,7 @@ stdenv.mkDerivation rec { # second call succeeds because it defers to $out/bin/bazel-{version}-{os_arch} hello_test - runHook postInstall + runHook postInstallCheck ''; # Save paths to hardcoded dependencies so Nix can detect them. diff --git a/pkgs/development/tools/build-managers/bazel/bazel_6/default.nix b/pkgs/development/tools/build-managers/bazel/bazel_6/default.nix index 27b747e3b67a..009ecd25ed88 100644 --- a/pkgs/development/tools/build-managers/bazel/bazel_6/default.nix +++ b/pkgs/development/tools/build-managers/bazel/bazel_6/default.nix @@ -779,12 +779,16 @@ stdenv.mkDerivation rec { installShellCompletion --fish \ --name bazel.fish \ ./bazel_src/output/bazel-complete.fish + + runHook postInstall ''; # Install check fails on `aarch64-darwin` # https://github.com/NixOS/nixpkgs/issues/145587 doInstallCheck = stdenv.hostPlatform.system != "aarch64-darwin"; installCheckPhase = '' + runHook preInstallCheck + export TEST_TMPDIR=$(pwd) hello_test () { @@ -829,7 +833,7 @@ stdenv.mkDerivation rec { exit 1 fi - runHook postInstall + runHook postInstallCheck ''; # Save paths to hardcoded dependencies so Nix can detect them. diff --git a/pkgs/development/tools/build-managers/bazel/bazel_7/default.nix b/pkgs/development/tools/build-managers/bazel/bazel_7/default.nix index cd62a9de62e2..4f5c45f6f464 100644 --- a/pkgs/development/tools/build-managers/bazel/bazel_7/default.nix +++ b/pkgs/development/tools/build-managers/bazel/bazel_7/default.nix @@ -635,9 +635,13 @@ stdenv.mkDerivation rec { installShellCompletion --fish \ --name bazel.fish \ ./bazel_src/output/bazel-complete.fish + + runHook postInstall ''; installCheckPhase = '' + runHook preInstallCheck + export TEST_TMPDIR=$(pwd) hello_test () { @@ -683,7 +687,7 @@ stdenv.mkDerivation rec { exit 1 fi - runHook postInstall + runHook postInstallCheck ''; # Save paths to hardcoded dependencies so Nix can detect them.