about summary refs log tree commit diff
path: root/pkgs/test/stdenv
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/test/stdenv')
-rw-r--r--pkgs/test/stdenv/default.nix19
1 files changed, 19 insertions, 0 deletions
diff --git a/pkgs/test/stdenv/default.nix b/pkgs/test/stdenv/default.nix
index 08e8eed118f98..ab5f98890bd33 100644
--- a/pkgs/test/stdenv/default.nix
+++ b/pkgs/test/stdenv/default.nix
@@ -95,6 +95,25 @@ in
 {
   test-env-attrset = testEnvAttrset { name = "test-env-attrset"; stdenv' = bootStdenv; };
 
+  # Test compatibility with derivations using `env` as a regular variable.
+  test-env-derivation = bootStdenv.mkDerivation rec {
+    name = "test-env-derivation";
+    env = bootStdenv.mkDerivation {
+      name = "foo";
+      buildCommand = ''
+        mkdir "$out"
+        touch "$out/bar"
+      '';
+    };
+
+    passAsFile = [ "buildCommand" ];
+    buildCommand = ''
+      declare -p env
+      [[ $env == "${env}" ]]
+      touch "$out"
+    '';
+  };
+
   test-prepend-append-to-var = testPrependAndAppendToVar {
     name = "test-prepend-append-to-var";
     stdenv' = bootStdenv;