Commit b05648b5 authored by nicoo's avatar nicoo
Browse files

nixos/sudo-rs: Simplify activation

parent 57241315
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -22,7 +22,7 @@

- [`sudo-rs`], a reimplementation of `sudo` in Rust, is now supported.
  An experimental new module `security.sudo-rs` was added.
  Switching to it (via `security.sudo.enable = false; security.sudo-rs.enable = true;`) introduces
  Switching to it (via ` security.sudo-rs.enable = true;`) introduces
  slight changes in sudo behaviour, due to `sudo-rs`' current limitations:
  - terminfo-related environment variables aren't preserved for `root` and `wheel`;
  - `root` and `wheel` are not given the ability to set (or preserve)
+6 −0
Original line number Diff line number Diff line
@@ -208,6 +208,12 @@ in
  ###### implementation

  config = mkIf cfg.enable {
    assertions = [ {
      assertion = ! config.security.sudo.enable;
      message = "`security.sudo` and `security.sudo-rs` cannot both be enabled";
    }];
    security.sudo.enable = mkDefault false;

    security.sudo-rs.extraRules =
      let
        defaultRule = { users ? [], groups ? [], opts ? [] }: [ {
+0 −4
Original line number Diff line number Diff line
@@ -22,8 +22,6 @@ in
          test5 = { isNormalUser = true; };
        };

        security.sudo.enable = false;

        security.sudo-rs = {
          enable = true;
          package = pkgs.sudo-rs;
@@ -56,8 +54,6 @@ in
        noadmin = { isNormalUser = true; };
      };

      security.sudo.enable = false;

      security.sudo-rs = {
        package = pkgs.sudo-rs;
        enable = true;