git.iko.soy/typeable/nixpkgs
on master help sign in
sudo: allow adding extra configuration options to the bottom of sudoers

from sudoers (5): When multiple entries match for a user, they are applied in order. Where there are multiple matches, the last match is used (which is not necessarily the most specific match).

commitf356cee747d04b2c29247c89b7d8cdacaa4a438a authorMathijs Kwik <mathijs@bluescreen303.nl> dateThu 30 Oct 2014, 13:59 (12 years ago) parent53614cf
1 file changed+11−1
nixos/modules/security/sudo.nix+11−1
nixos/modules/security/sudo.nix+11−1
@@ -46,6 +46,14 @@ in
4646 <filename>sudoers</filename> file.
4747 '';
4848 };
49+
50+ security.sudo.extraConfig = mkOption {
51+ type = types.lines;
52+ default = "";
53+ description = ''
54+ Extra configuration text appended to <filename>sudoers</filename>.
55+ '';
56+ };
4957 };
5058
5159
@@ -55,7 +63,8 @@ in
5563
5664 security.sudo.configFile =
5765 ''
58− # Don't edit this file. Set the NixOS option ‘security.sudo.configFile’ instead.
66+ # Don't edit this file. Set the NixOS options ‘security.sudo.configFile’
67+ # and security.sudo.extraConfig instead.
5968
6069 # Environment variables to keep for root and %wheel.
6170 Defaults:root,%wheel env_keep+=TERMINFO_DIRS
@@ -69,6 +78,7 @@ in
6978
7079 # Users in the "wheel" group can do anything.
7180 %wheel ALL=(ALL) ${if cfg.wheelNeedsPassword then "" else "NOPASSWD: ALL, "}SETENV: ALL
81+ ${cfg.extraConfig}
7282 '';
7383
7484 security.setuidPrograms = [ "sudo" "sudoedit" ];