Merge pull request #230666 from alyssais/inputDerivation-passAsFile
stdenv: fix inputDerivation with passAsFile
This commit is contained in:
commit
9524f57dd5
|
@ -545,7 +545,13 @@ lib.extendDerivation
|
||||||
# binaries). By writing this to $out, Nix can find and register
|
# binaries). By writing this to $out, Nix can find and register
|
||||||
# them as runtime dependencies (since Nix greps for store paths
|
# them as runtime dependencies (since Nix greps for store paths
|
||||||
# through $out to find them)
|
# through $out to find them)
|
||||||
args = [ "-c" "export > $out" ];
|
args = [ "-c" ''
|
||||||
|
export > $out
|
||||||
|
for var in $passAsFile; do
|
||||||
|
pathVar="''${var}Path"
|
||||||
|
printf "%s" "$(< "''${!pathVar}")" >> $out
|
||||||
|
done
|
||||||
|
'' ];
|
||||||
|
|
||||||
# inputDerivation produces the inputs; not the outputs, so any
|
# inputDerivation produces the inputs; not the outputs, so any
|
||||||
# restrictions on what used to be the outputs don't serve a purpose
|
# restrictions on what used to be the outputs don't serve a purpose
|
||||||
|
|
|
@ -142,6 +142,21 @@ in
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
test-inputDerivation = let
|
||||||
|
inherit (stdenv.mkDerivation {
|
||||||
|
dep1 = derivation { name = "dep1"; builder = "/bin/sh"; args = [ "-c" ": > $out" ]; system = builtins.currentSystem; };
|
||||||
|
dep2 = derivation { name = "dep2"; builder = "/bin/sh"; args = [ "-c" ": > $out" ]; system = builtins.currentSystem; };
|
||||||
|
passAsFile = [ "dep2" ];
|
||||||
|
}) inputDerivation;
|
||||||
|
in
|
||||||
|
runCommand "test-inputDerivation" {
|
||||||
|
exportReferencesGraph = [ "graph" inputDerivation ];
|
||||||
|
} ''
|
||||||
|
grep ${inputDerivation.dep1} graph
|
||||||
|
grep ${inputDerivation.dep2} graph
|
||||||
|
touch $out
|
||||||
|
'';
|
||||||
|
|
||||||
test-prepend-append-to-var = testPrependAndAppendToVar {
|
test-prepend-append-to-var = testPrependAndAppendToVar {
|
||||||
name = "test-prepend-append-to-var";
|
name = "test-prepend-append-to-var";
|
||||||
stdenv' = bootStdenv;
|
stdenv' = bootStdenv;
|
||||||
|
|
Loading…
Reference in a new issue