aboutsummaryrefslogtreecommitdiff
path: root/tests/functional/readfile-context.nix
blob: 54cd1afd9d3b1370303cb9b15585947c3e0a0b45 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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