From 1c1a361021652f1c300b4cb4c25585bef11cf064 Mon Sep 17 00:00:00 2001 From: sinanmohd Date: Thu, 29 Aug 2024 22:21:14 +0530 Subject: pc/nopolkit: init --- os/pc/modules/nopolkit.nix | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 os/pc/modules/nopolkit.nix (limited to 'os/pc/modules') diff --git a/os/pc/modules/nopolkit.nix b/os/pc/modules/nopolkit.nix new file mode 100644 index 0000000..0c45f41 --- /dev/null +++ b/os/pc/modules/nopolkit.nix @@ -0,0 +1,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 ]; + }]; + }; +} -- cgit v1.2.3