git.iko.soy/typeable/nixpkgs
on master help sign in
sudo: allow adding extra configuration options to the bottom of sudoers
f356ceeMathijs Kwik
nixos/modules/security/sudo.nix+11−1
@@ -46,6 +46,14 @@ in
46 <filename>sudoers</filename> file.
46 <filename>sudoers</filename> file.
47 '';
47 '';
48 };
48 };
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+ };
49 };
57 };
50
58
51
59
@@ -55,7 +63,8 @@ in
55
63
56 security.sudo.configFile =
64 security.sudo.configFile =
57 ''
65 ''
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.
59
68
60 # Environment variables to keep for root and %wheel.
69 # Environment variables to keep for root and %wheel.
61 Defaults:root,%wheel env_keep+=TERMINFO_DIRS
70 Defaults:root,%wheel env_keep+=TERMINFO_DIRS
@@ -69,6 +78,7 @@ in
69
78
70 # Users in the "wheel" group can do anything.
79 # Users in the "wheel" group can do anything.
71 %wheel ALL=(ALL) ${if cfg.wheelNeedsPassword then "" else "NOPASSWD: ALL, "}SETENV: ALL
80 %wheel ALL=(ALL) ${if cfg.wheelNeedsPassword then "" else "NOPASSWD: ALL, "}SETENV: ALL
81+ ${cfg.extraConfig}
72 '';
82 '';
73
83
74 security.setuidPrograms = [ "sudo" "sudoedit" ];
84 security.setuidPrograms = [ "sudo" "sudoedit" ];