diff options
author | Théophane Hufschmitt <theophane.hufschmitt@tweag.io> | 2022-11-14 15:13:46 +0100 |
---|---|---|
committer | Naïm Favier <n@monade.li> | 2022-11-14 16:13:26 +0100 |
commit | cb39e9a99e21812b424d7d2318157163ab97fc82 (patch) | |
tree | f36ef844ca102ca06495e04132e3ce92cc5833a4 | |
parent | 6bf873651740b1552dea6f30c7778dff11bc52ed (diff) |
Test that the result of `readFile` gets ref-scanned
-rw-r--r-- | tests/readfile-context.builder.sh | 1 | ||||
-rw-r--r-- | tests/readfile-context.nix | 19 |
2 files changed, 14 insertions, 6 deletions
diff --git a/tests/readfile-context.builder.sh b/tests/readfile-context.builder.sh deleted file mode 100644 index 7084a08cb..000000000 --- a/tests/readfile-context.builder.sh +++ /dev/null @@ -1 +0,0 @@ -echo "$input" > $out diff --git a/tests/readfile-context.nix b/tests/readfile-context.nix index 600036a94..54cd1afd9 100644 --- a/tests/readfile-context.nix +++ b/tests/readfile-context.nix @@ -6,14 +6,23 @@ let dependent = mkDerivation { name = "dependent"; - builder = ./readfile-context.builder.sh; - input = "${input}/hello"; + buildCommand = '' + mkdir -p $out + echo -n "$input1" > "$out/file1" + echo -n "$input2" > "$out/file2" + ''; + input1 = "${input}/hello"; + input2 = "hello"; }; readDependent = mkDerivation { - name = "read-dependent"; - builder = ./readfile-context.builder.sh; - input = builtins.readFile dependent; + # 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"); }; in readDependent |