nixos/sudo: Don't include empty sections
This makes the generated sudoers a touch easier to read.
This commit is contained in:
parent
a8e6f0a81a
commit
ad92951579
1 changed files with 8 additions and 4 deletions
|
@ -203,7 +203,7 @@ in
|
|||
}
|
||||
];
|
||||
|
||||
security.sudo.configFile =
|
||||
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.
|
||||
|
@ -213,7 +213,8 @@ in
|
|||
|
||||
# "root" is allowed to do anything.
|
||||
root ALL=(ALL:ALL) SETENV: ALL
|
||||
|
||||
''
|
||||
(optionalString (cfg.extraRules != []) ''
|
||||
# extraRules
|
||||
${concatStringsSep "\n" (
|
||||
lists.flatten (
|
||||
|
@ -225,9 +226,12 @@ in
|
|||
) cfg.extraRules
|
||||
)
|
||||
)}
|
||||
|
||||
'')
|
||||
(optionalString (cfg.extraConfig != "") ''
|
||||
# extraConfig
|
||||
${cfg.extraConfig}
|
||||
'';
|
||||
'')
|
||||
]);
|
||||
|
||||
security.wrappers = let
|
||||
owner = "root";
|
||||
|
|
Loading…
Reference in a new issue