summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--os/pc/configuration.nix1
-rw-r--r--os/pc/modules/nopolkit.nix26
2 files changed, 27 insertions, 0 deletions
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 ];
+ }];
+ };
+}