From 22b33b9d080f5220d399596790a5d69fe89add53 Mon Sep 17 00:00:00 2001 From: Rebecca Turner Date: Mon, 29 Dec 2025 11:03:40 -0800 Subject: [PATCH] package.nix: set `$BUILD_TEST_ENV`/`$BUILD_TEST_SHELL` more consistently cl/4796 introduced a bug where running `just test-functional2` would hang forever on macOS but `meson test -C build --suite installcheck functional2` would succeed because of a mismatch between the `$BUILD_TEST_SHELL` environment variable and the `-Dbuild-test-shell` build option set in `mesonFlags`. We can move these definitions to `finalAttrs.buildTestShell` and similar and use those values in _both_ `mesonFlags` and `env` in order to make them consistent in all cases. See: https://gerrit.lix.systems/c/lix/+/4796/comments/50def5b4_fa5671f2 Change-Id: If300bbe46d6269ace29b44156fb4a5196a6a6964 --- package.nix | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/package.nix b/package.nix index 4e2e59028..5f44fd9e5 100644 --- a/package.nix +++ b/package.nix @@ -256,6 +256,16 @@ stdenv.mkDerivation (finalAttrs: { ] ); + buildTestShell = + if hostPlatform.isLinux then + "${pkgsStatic.bash}/bin" + else if hostPlatform.isDarwin then + "${bash}/bin" + else + null; + + buildTestEnv = if hostPlatform.isLinux then "${pkgsStatic.busybox}/bin" else null; + src = fileset.toSource { root = ./.; fileset = fileset.intersection baseFiles ( @@ -297,13 +307,12 @@ stdenv.mkDerivation (finalAttrs: { # which don't actually get added to PATH. And buildInputs is correct over # nativeBuildInputs since this should be a busybox executable on the host. "-Dsandbox-shell=${lib.getExe' busybox-sandbox-shell "busybox"}" - "-Dbuild-test-shell=${pkgsStatic.bash}/bin" - "-Dbuild-test-env=${pkgsStatic.busybox}/bin" "-Dpasta-path=${lib.getExe' passt-lix "pasta"}" ] - ++ lib.optionals hostPlatform.isDarwin [ - "-Dbuild-test-shell=${bash}/bin" - ] + ++ lib.optional ( + finalAttrs.buildTestShell != null + ) "-Dbuild-test-shell=${finalAttrs.buildTestShell}" + ++ lib.optional (finalAttrs.buildTestEnv != null) "-Dbuild-test-env=${finalAttrs.buildTestEnv}" ++ lib.optionals useLld [ "-Dc_link_args=-fuse-ld=lld" "-Dcpp_link_args=-fuse-ld=lld" @@ -436,9 +445,11 @@ stdenv.mkDerivation (finalAttrs: { VERSION_SUFFIX = versionSuffix; } - // lib.optionalAttrs hostPlatform.isLinux { - BUILD_TEST_SHELL = "${pkgsStatic.bash}/bin"; - BUILD_TEST_ENV = "${pkgsStatic.busybox}/bin"; + // lib.optionalAttrs (finalAttrs.buildTestEnv != null) { + BUILD_TEST_ENV = finalAttrs.buildTestEnv; + } + // lib.optionalAttrs (finalAttrs.buildTestShell != null) { + BUILD_TEST_SHELL = finalAttrs.buildTestShell; } // lib.optionalAttrs hostPlatform.isStatic { NIX_CFLAGS_COMPILE = " -static";