about summary refs log tree commit diff
path: root/users/sterni/nix/misc/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'users/sterni/nix/misc/default.nix')
-rw-r--r--users/sterni/nix/misc/default.nix18
1 files changed, 18 insertions, 0 deletions
diff --git a/users/sterni/nix/misc/default.nix b/users/sterni/nix/misc/default.nix
new file mode 100644
index 000000000000..1de9c973ec84
--- /dev/null
+++ b/users/sterni/nix/misc/default.nix
@@ -0,0 +1,18 @@
+{ ... }:
+
+let
+  /* Returns true if it is being evaluated using restrict-eval, false if not.
+     It's more robust than using `builtins.getEnv` since it isn't fooled by
+     `env -i`.
+
+     See https://github.com/NixOS/nix/issues/6579 for a description of the
+     behavior. Precise cause in the evaluator / store implementation is unclear.
+
+     Type: bool
+  */
+  inRestrictedEval = builtins.pathExists (toString ./guinea-pig + "/.");
+in
+
+{
+  inherit inRestrictedEval;
+}