1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-18 19:51:17 +00:00

nixos/sudo: Don't include empty sections

This makes the generated sudoers a touch easier to read.
This commit is contained in:
nicoo 2023-09-04 21:01:09 +00:00
parent 409d29ca73
commit 454151375d

View file

@ -205,7 +205,7 @@ in
}
];
security.sudo.configFile = concatStringsSep "\n" [
security.sudo.configFile = concatStringsSep "\n" (filter (s: s != "") [
''
# Don't edit this file. Set the NixOS options security.sudo.configFile
# or security.sudo.extraRules instead.
@ -218,7 +218,7 @@ in
# "root" is allowed to do anything.
root ALL=(ALL:ALL) SETENV: ALL
''
''
(optionalString (cfg.extraRules != []) ''
# extraRules
${concatStringsSep "\n" (
lists.flatten (
@ -230,12 +230,12 @@ in
) cfg.extraRules
)
)}
''
''
'')
(optionalString (cfg.extraConfig != "") ''
# extraConfig
${cfg.extraConfig}
''
];
'')
]);
security.wrappers = let
owner = "root";