lix/tests/functional/readfile-context.nix

29 lines
650 B
Nix
Raw Normal View History

2017-11-10 23:51:34 +01:00
with import ./config.nix;
let
input = import ./simple.nix;
dependent = mkDerivation {
name = "dependent";
buildCommand = ''
mkdir -p $out
echo -n "$input1" > "$out/file1"
echo -n "$input2" > "$out/file2"
'';
input1 = "${input}/hello";
input2 = "hello";
2017-11-10 23:51:34 +01:00
};
readDependent = mkDerivation {
# Will evaluate correctly because file2 doesn't have any references,
# even though the `dependent` derivation does.
name = builtins.readFile (dependent + "/file2");
buildCommand = ''
echo "$input" > "$out"
'';
input = builtins.readFile (dependent + "/file1");
2017-11-10 23:51:34 +01:00
};
in readDependent