stdenv: handle env gracefully#205944
Merged
ncfavier merged 2 commits intoNixOS:stagingfrom Dec 15, 2022
Merged
Conversation
13 tasks
Member
|
Could you test this in |
Artturin
reviewed
Dec 13, 2022
Member
diff --git a/pkgs/test/stdenv/default.nix b/pkgs/test/stdenv/default.nix
index b27fc25356a..2274a20ff17 100644
--- a/pkgs/test/stdenv/default.nix
+++ b/pkgs/test/stdenv/default.nix
@@ -100,6 +100,25 @@ in
test-env-attrset = testEnvAttrset { name = "test-env-attrset"; stdenv' = bootStdenv; };
+ test-env-equals-derivation = bootStdenv.mkDerivation rec {
+ name = "test-env-equals-derivation";
+ env = bootStdenv.mkDerivation {
+ name = "foo";
+ buildCommand = ''
+ mkdir $out
+ touch $out/bar
+ '';
+ };
+
+ passAsFile = [ "buildCommand" ];
+ buildCommand = ''
+ declare -p env
+ echo ''${env[0]}
+ [[ "''${env[0]}" == "${env.out}" ]]
+ touch $out
+ '';
+ };
+
test-prepend-append-to-var = testPrependAndAppendToVar {
name = "test-prepend-append-to-var";
stdenv' = bootStdenv; |
a12b1c2 to
f65096c
Compare
Member
Author
|
Confirmed that the test fails on the previous commit. |
Artturin
reviewed
Dec 14, 2022
f65096c to
f3de115
Compare
Derivations not using `__structuredAttrs` should not attempt to set environment variables from `env`. Derivations using `__structuredAttrs` should fail if `env` is not exportable.
6e1bab3 to
9b1e8d7
Compare
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Derivations not using
__structuredAttrsshould not attempt to set environment variables fromenv.Derivations using
__structuredAttrsshould fail ifenvis not exportable.See #175649 (comment)