summaryrefslogtreecommitdiff
path: root/os/pc/modules/nopolkit.nix
blob: 0c45f4130a867dab921224f5d2250231642a3bec (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
{ config, pkgs, ... }: let
  user = config.global.userdata.name;
in {
  security.sudo = {
    enable = true;

    extraRules = [{
      commands = [
        {
          command = "${pkgs.systemd}/bin/systemctl suspend-then-hibernate";
          options = [ "SETENV" "NOPASSWD" ];
        }
        {
          command = "${pkgs.systemd}/bin/reboot";
          options = [ "NOPASSWD" ];
        }
        {
          command = "${pkgs.systemd}/bin/poweroff";
          options = [ "NOPASSWD" ];
        }
      ];

      users = [ user ];
    }];
  };
}