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
nixos/systemd: Fix environment type -> allows overriding #38356
Conversation
@@ -217,7 +217,7 @@ in rec { | |||
|
|||
environment = mkOption { | |||
default = {}; | |||
type = types.attrs; # FIXME | |||
type = with types; attrsOf (nullOr (either str package)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm using str | package
because str
doesn't match derivations, which are used as values in nixpkgs, and can still be converted to strings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ran an evaluation of all of the tests, nothing failed because of the more restrictive type.
For reference, these values get converted to a string here: nixpkgs/nixos/modules/system/boot/systemd.nix Lines 321 to 324 in 00fc66d
|
@@ -217,7 +217,7 @@ in rec { | |||
|
|||
environment = mkOption { | |||
default = {}; | |||
type = types.attrs; # FIXME | |||
type = with types; attrsOf (nullOr (either str package)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ran an evaluation of all of the tests, nothing failed because of the more restrictive type.
This seems to have been backported to 18.03 (df4eae6) but the follow-up fix on master (fb2a8d6) has not been backported. I think this is why my box's config no longer evaluates on 18.03. Can folks involved take a look and backport that second commit if it's appropriate/okay/safe? cc @infinisil @oxij (committers). FWIW the error I'm getting is this, which may not be related (but checking the follow-up commit seems warranted regardless):
Where nixos channel is: |
The commit looks good to me, I didn't think about |
Shouldn't this get fixed for nixpkgs/nixos/modules/system/boot/systemd.nix Line 518 in f3fcf1b
|
Done in 35c069e |
Motivation for this change
A user on IRC tried to override an environment variable of a service, which didn't work even with
mkForce
. Turns out reason being is that the type of theenvironment
option of a service was wrong.Things done
I built my 3 nixos systems with this change and I didn't get an evaluation error.
build-use-sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)