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/configuration.nix | 1 + os/pc/modules/nopolkit.nix | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 os/pc/modules/nopolkit.nix diff --git a/os/pc/configuration.nix b/os/pc/configuration.nix index e865580..180080f 100644 --- a/os/pc/configuration.nix +++ b/os/pc/configuration.nix @@ -8,6 +8,7 @@ in { ./modules/sshfs.nix ./modules/network.nix ./modules/wayland.nix + ./modules/nopolkit.nix ]; boot = { 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