From 83669e31a201c95d34f16d85d26e39c6d15c5cfd Mon Sep 17 00:00:00 2001 From: Philip Taron Date: Mon, 16 Feb 2026 09:08:26 -0800 Subject: [PATCH] tests.buildenv: test derivationArgs forwarding Verify that: - derivationArgs attributes reach the underlying mkDerivation (tested via allowSubstitutes overriding the default false) - The backward-compat layer for top-level nativeBuildInputs still works (these are forwarded through compatArgs) --- pkgs/test/buildenv.nix | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/pkgs/test/buildenv.nix b/pkgs/test/buildenv.nix index 35b9d18162f0..cc0d9b3e128f 100644 --- a/pkgs/test/buildenv.nix +++ b/pkgs/test/buildenv.nix @@ -159,12 +159,43 @@ let }; }; + tests-derivationArgs = + let + env = buildEnv { + name = "test-env"; + paths = [ ]; + derivationArgs.allowSubstitutes = true; + }; + in + { + # derivationArgs.allowSubstitutes overrides the default (false) + testDerivationArgsForwarded = { + expr = env.allowSubstitutes; + expected = true; + }; + + # Backward compat: top-level nativeBuildInputs still works + testCompatNativeBuildInputs = { + expr = + let + env' = buildEnv { + name = "test-env"; + paths = [ ]; + nativeBuildInputs = [ pkgs.hello ]; + }; + in + builtins.length env'.nativeBuildInputs > 0; + expected = true; + }; + }; + tests = tests-name // tests-passthru-paths // tests-finalAttrs // tests-overrideAttrs - // tests-passthru-merging; + // tests-passthru-merging + // tests-derivationArgs; in stdenvNoCC.mkDerivation (finalAttrs: {