1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-24 22:11:15 +02:00

Restore dynamic derivations!

This method does *not* create a new type of goal. We instead just make
`DerivationGoal` more sophisticated, which is much easier to do now that
`DerivationBuildingGoal` has been split from it (and so many fields are
gone, or or local variables instead).

This avoids the need for a secondarily trampoline goal that interacted
poorly with `addWantedOutputs`. That, I hope, will mean the bugs from
before do not reappear.

There may in fact be a reason to introduce such a trampoline in the
future, but it would only happen in conjunction with getting rid of
`addWantedOutputs`.

Restores the functionality (and tests) that was reverted in
f4f28cdd0e.
This commit is contained in:
John Ericson 2025-05-14 13:35:37 -04:00
parent bf5d544d3b
commit 57348b677b
12 changed files with 145 additions and 77 deletions

View file

@ -18,4 +18,9 @@ clearStore
drvDep=$(nix-instantiate ./text-hashed-output.nix -A producingDrv)
expectStderr 1 nix build "${drvDep}^out^out" --no-link | grepQuiet "Building dynamic derivations in one shot is not yet implemented"
# Store layer needs bugfix
requireDaemonNewerThan "2.30pre20250515"
out2=$(nix build "${drvDep}^out^out" --no-link)
test $out1 == $out2

View file

@ -3,7 +3,7 @@
source common.sh
# Store layer needs bugfix
requireDaemonNewerThan "2.27pre20250205"
requireDaemonNewerThan "2.30pre20250515"
TODO_NixOS # can't enable a sandbox feature easily
@ -13,4 +13,4 @@ restartDaemon
NIX_BIN_DIR="$(dirname "$(type -p nix)")"
export NIX_BIN_DIR
expectStderr 1 nix build -L --file ./non-trivial.nix --no-link | grepQuiet "Building dynamic derivations in one shot is not yet implemented"
nix build -L --file ./non-trivial.nix --no-link

View file

@ -4,8 +4,11 @@ source common.sh
out1=$(nix-build ./text-hashed-output.nix -A hello --no-out-link)
# Store layer needs bugfix
requireDaemonNewerThan "2.30pre20250515"
clearStore
expectStderr 1 nix-build ./text-hashed-output.nix -A wrapper --no-out-link | grepQuiet "Building dynamic derivations in one shot is not yet implemented"
out2=$(nix-build ./text-hashed-output.nix -A wrapper --no-out-link)
# diff -r $out1 $out2
diff -r $out1 $out2

View file

@ -3,9 +3,7 @@
source common.sh
# Store layer needs bugfix
requireDaemonNewerThan "2.27pre20250205"
skipTest "dyn drv input scheduling had to be reverted for 2.27"
requireDaemonNewerThan "2.30pre20250515"
expected=100
if [[ -v NIX_DAEMON_PACKAGE ]]; then expected=1; fi # work around the daemon not returning a 100 status correctly