1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-24 22:11:15 +02:00
nix/tests/functional/dyn-drv/text-hashed-output.nix
Robert Hensing 07f853b295
Merge pull request #9415 from NixOS/fix-dynamic-derivations
Revert "Revert "Adapt scheduler to work with dynamic derivations
2025-02-16 23:59:39 +01:00

43 lines
1.1 KiB
Nix

with import ./config.nix;
# A simple content-addressing derivation.
# The derivation can be arbitrarily modified by passing a different `seed`,
# but the output will always be the same
rec {
hello = mkDerivation {
name = "hello";
buildCommand = ''
set -x
echo "Building a CA derivation"
mkdir -p $out
echo "Hello World" > $out/hello
'';
};
producingDrv = mkDerivation {
name = "hello.drv";
buildCommand = ''
echo "Copying the derivation"
cp ${builtins.unsafeDiscardOutputDependency hello.drvPath} $out
'';
__contentAddressed = true;
outputHashMode = "text";
outputHashAlgo = "sha256";
};
wrapper = mkDerivation {
name = "use-dynamic-drv-in-non-dynamic-drv";
buildCommand = ''
echo "Copying the output of the dynamic derivation"
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
'';
};
}