1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-25 06:31:14 +02:00

Merge pull request #9415 from NixOS/fix-dynamic-derivations

Revert "Revert "Adapt scheduler to work with dynamic derivations
This commit is contained in:
Robert Hensing 2025-02-16 23:59:39 +01:00 committed by GitHub
commit 07f853b295
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 397 additions and 42 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.27pre20250205"
out2=$(nix build "${drvDep}^out^out" --no-link)
test $out1 == $out2

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.27pre20250205"
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

@ -0,0 +1,12 @@
#!/usr/bin/env bash
source common.sh
# Store layer needs bugfix
requireDaemonNewerThan "2.27pre20250205"
expected=100
if [[ -v NIX_DAEMON_PACKAGE ]]; then expected=1; fi # work around the daemon not returning a 100 status correctly
expectStderr "$expected" nix-build ./text-hashed-output.nix -A failingWrapper --no-out-link \
| grepQuiet "build of '.*use-dynamic-drv-in-non-dynamic-drv-wrong.drv' failed"

View file

@ -12,6 +12,7 @@ suites += {
'recursive-mod-json.sh',
'build-built-drv.sh',
'eval-outputOf.sh',
'failing-outer.sh',
'dep-built-drv.sh',
'old-daemon-error-hack.sh',
],

View file

@ -13,6 +13,7 @@ rec {
echo "Hello World" > $out/hello
'';
};
producingDrv = mkDerivation {
name = "hello.drv";
buildCommand = ''
@ -23,6 +24,7 @@ rec {
outputHashMode = "text";
outputHashAlgo = "sha256";
};
wrapper = mkDerivation {
name = "use-dynamic-drv-in-non-dynamic-drv";
buildCommand = ''
@ -30,4 +32,12 @@ rec {
cp -r ${builtins.outputOf producingDrv.outPath "out"} $out
'';
};
failingWrapper = mkDerivation {
name = "use-dynamic-drv-in-non-dynamic-drv-wrong";
buildCommand = ''
echo "Fail at copying the output of the dynamic derivation"
fail ${builtins.outputOf producingDrv.outPath "out"} $out
'';
};
}