tests.buildenv: test finalAttrs self-reference

This is the core new capability of the PR: `buildEnv` now accepts a function `(finalAttrs: { ... })` enabling self-referencing attributes.

Verify that finalAttrs.name is accessible from within the argument function.
This commit is contained in:
Philip Taron
2026-03-19 13:17:20 -07:00
parent 150cd2ae32
commit effd58ab3e
+16 -1
View File
@@ -67,7 +67,22 @@ let
};
};
tests = tests-name // tests-passthru-paths;
tests-finalAttrs = {
testFinalAttrsSelfReference = {
expr =
let
env = buildEnv (finalAttrs: {
name = "test-env";
paths = [ ];
passthru.description = "An env named ${finalAttrs.name}";
});
in
env.description;
expected = "An env named test-env";
};
};
tests = tests-name // tests-passthru-paths // tests-finalAttrs;
in
stdenvNoCC.mkDerivation (finalAttrs: {