summary refs log tree commit diff
diff options
context:
space:
mode:
authornicoo <nicoo@mur.at>2023-09-07 12:50:48 +0000
committernicoo <nicoo@mur.at>2023-11-08 19:41:39 +0000
commit1852b67bc60e34ae6e7d3cba51892668a83e1a1d (patch)
tree6041d61fdbdceda5b7f29b09e4f81a2bd0db76f9
parent93011e31bddcd11765eff62defb796cc2d373acb (diff)
downloadnixpkgs-1852b67bc60e34ae6e7d3cba51892668a83e1a1d.tar
nixpkgs-1852b67bc60e34ae6e7d3cba51892668a83e1a1d.tar.gz
nixpkgs-1852b67bc60e34ae6e7d3cba51892668a83e1a1d.tar.bz2
nixpkgs-1852b67bc60e34ae6e7d3cba51892668a83e1a1d.tar.lz
nixpkgs-1852b67bc60e34ae6e7d3cba51892668a83e1a1d.tar.xz
nixpkgs-1852b67bc60e34ae6e7d3cba51892668a83e1a1d.tar.zst
nixpkgs-1852b67bc60e34ae6e7d3cba51892668a83e1a1d.zip
nixos/sudo: Make the default rules' options configurable
-rw-r--r--nixos/modules/security/sudo.nix13
1 files changed, 11 insertions, 2 deletions
diff --git a/nixos/modules/security/sudo.nix b/nixos/modules/security/sudo.nix
index aab5213d6dc..03f38b543d6 100644
--- a/nixos/modules/security/sudo.nix
+++ b/nixos/modules/security/sudo.nix
@@ -32,6 +32,15 @@ in
 
   options.security.sudo = {
 
+    defaultOptions = mkOption {
+      type = with types; listOf str;
+      default = [ "SETENV" ];
+      description = mdDoc ''
+        Options used for the default rules, granting `root` and the
+        `wheel` group permission to run any command as any user.
+      '';
+    };
+
     enable = mkEnableOption (mdDoc ''
       the {command}`sudo` command, which allows non-root users to execute commands as root.
     '');
@@ -188,8 +197,8 @@ in
           inherit users groups;
           commands = [ {
             command = "ALL";
-            options = opts ++ [ "SETENV" ];
-	  } ];
+            options = opts ++ cfg.defaultOptions;
+          } ];
         } ];
       in mkMerge [
         # This is ordered before users' `mkBefore` rules,