about summary refs log tree commit diff
path: root/modules/nixos/common/security.nix
blob: 09c5da191f996873ccec4e859a8fbfc9db604774 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
{
  inputs,
  lib,
  ...
}:
with lib; {
  security = {
    sudo = {
      enable = true;
      execWheelOnly = true;
      wheelNeedsPassword = false;
      # https://mwl.io/archives/1000
      extraConfig = ''
        Defaults env_keep += "SSH_CLIENT SSH_CONNECTION SSH_TTY SSH_AUTH_SOCK"
      '';
    };

    polkit = {
      enable = true;
      # https://wiki.archlinux.org/title/Polkit#Bypass_password_prompt
      extraConfig = ''
        polkit.addRule(function (action, subject) {
          if (subject.isInGroup('wheel'))
            return polkit.Result.YES;
        });
      '';
    };
  };
}

Consider giving Nix/NixOS a try! <3