aboutsummaryrefslogtreecommitdiff
path: root/tests/functional/ca/nondeterministic.nix
blob: d6d099a3e0e970b58d81b6d3ca9bce9a965399ba (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
29
30
31
32
33
34
35
with import ./config.nix;

let mkCADerivation = args: mkDerivation ({
    __contentAddressed = true;
    outputHashMode = "recursive";
    outputHashAlgo = "sha256";
} // args);
in

rec {
  currentTime = mkCADerivation {
    name = "current-time";
    buildCommand = ''
      mkdir $out
      echo $(date) > $out/current-time
    '';
  };
  dep = seed: mkCADerivation {
    name = "dep";
    inherit seed;
    buildCommand = ''
      echo ${currentTime} > $out
    '';
  };
  dep1 = dep 1;
  dep2 = dep 2;
  toplevel = mkCADerivation {
    name = "toplevel";
    buildCommand = ''
      test ${dep1} == ${dep2}
      touch $out
    '';
  };
}