Skip to content

nixos/shells-environment: make environment.variables lazy#79289

Closed
edef1c wants to merge 1 commit intoNixOS:masterfrom
edef1c:lazy-env-vars
Closed

nixos/shells-environment: make environment.variables lazy#79289
edef1c wants to merge 1 commit intoNixOS:masterfrom
edef1c:lazy-env-vars

Conversation

@edef1c
Copy link
Member

@edef1c edef1c commented Feb 5, 2020

Motivation for this change

This allows depending on config.environment.variables.* values without causing infinite recursion.

Things done

@ofborg ofborg bot added 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` labels Feb 5, 2020
@infinisil
Copy link
Member

Unfortunately lazyAttrsOf isn't a panacea against strictness. I described this in the docs, namely that it doesn't work 100% with mkIf false-style definitions, which is also apparent from ofborg's error, because it leads to

environment.variables = {
GTK_USE_PORTAL = mkIf cfg.gtkUsePortal "1";

This is why lazyAttrsOf should only be used where either mkIf style definitions can't be used anyways (which is seldom the case, but an example is the one use introduced in #70138), or by making sure an unset value is somehow later processed/filtered, which is what I'm doing in #75584

@edef1c
Copy link
Member Author

edef1c commented Feb 5, 2020

ACK. I figured I'd throw it at ofborg and see if it'd stick, since it had been working fine on my local machine so far.

@edef1c edef1c closed this Feb 5, 2020
@edef1c edef1c deleted the lazy-env-vars branch February 5, 2020 20:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/`

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants