aboutsummaryrefslogtreecommitdiff
path: root/tests/ca/nondeterministic.nix
diff options
context:
space:
mode:
authorMatthew Kenigsberg <matthewkenigsberg@gmail.com>2021-09-15 11:51:52 -0500
committerMatthew Kenigsberg <matthewkenigsberg@gmail.com>2021-09-15 11:58:06 -0500
commit3b82c1a5fef521ebadea5df12384390c8c24100c (patch)
tree67fd413bcf0b42c5ada7eddc41a04f7bd99df3a8 /tests/ca/nondeterministic.nix
parente023c985d58094041e74ff59a51757bc75687ca7 (diff)
parentd2c8eed34496b650935e4563ffe3174978bd22fc (diff)
Merge remote-tracking branch 'upstream/master' into auto-uid-allocation
Diffstat (limited to 'tests/ca/nondeterministic.nix')
-rw-r--r--tests/ca/nondeterministic.nix35
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/ca/nondeterministic.nix b/tests/ca/nondeterministic.nix
new file mode 100644
index 000000000..d6d099a3e
--- /dev/null
+++ b/tests/ca/nondeterministic.nix
@@ -0,0 +1,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
+ '';
+ };
+}
+