aboutsummaryrefslogtreecommitdiff
path: root/tests/functional/readfile-context.nix
diff options
context:
space:
mode:
Diffstat (limited to 'tests/functional/readfile-context.nix')
-rw-r--r--tests/functional/readfile-context.nix28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/functional/readfile-context.nix b/tests/functional/readfile-context.nix
new file mode 100644
index 000000000..54cd1afd9
--- /dev/null
+++ b/tests/functional/readfile-context.nix
@@ -0,0 +1,28 @@
+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";
+ };
+
+ 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");
+ };
+
+in readDependent