-
-
Notifications
You must be signed in to change notification settings - Fork 14.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
stdenv: fix env pass through with structured attrs #334772
base: staging
Are you sure you want to change the base?
Conversation
I’m too tired to understand the subtleties here right now, but FWIW you don’t need to target |
When using structured attributes, `env` attributes must not be derivation arguments. Fixes the following example: ``` let drv = stdenv.mkDerivation { name = "foo"; __structuredAttrs = true; env.FOO = "foo"; }; in stdenv.mkDerivation drv.drvAttrs ``` Note that passthru takes precedence over env. ``` nix-repl> (stdenv.mkDerivation { name = "foo"; env.FOO = "foo"; passthru.FOO = "bar"; }).FOO "bar" ```
So what to do instead? Another option that's less "invasive" perhaps, is to add a function like For context, I should note that I intend to use It's not the only reason to preserve the meaning of |
@roberth, thanks for detailed answer! Unfortunately, I don’t have enough time to design and implement the proposed alternatives. Besides, and I’m not really a fan of how mkDerivation currently exposes all attributes right now. I think your PR #217243 was a move in the right direction. For #334662, I’ll just use |
Description of changes
Note
I need this for #334662, so ideally I’d like to target staging even if there are no mass rebuilds.
When using structured attributes,
env
attributes must not be derivation arguments to allow reusingdrvAttrs
as an argument formkDerivation
(e.g. see srcOnly).Fixes the following example:
In practice, it fixes
srcOnly
for derivations with structured attributes that setenv
.Things done
nix.conf
? (See Nix manual)sandbox = relaxed
sandbox = true
nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)Add a 👍 reaction to pull requests you find important.