From 83f548e95f80ba16b4caa40134e4765d66dd0e76 Mon Sep 17 00:00:00 2001 From: Noah Masur <7386960+nmasur@users.noreply.github.com> Date: Sun, 19 Jan 2025 20:07:12 +0000 Subject: [PATCH] fix: power button immediately shuts down pc --- modules/nixos/hardware/sleep.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/nixos/hardware/sleep.nix b/modules/nixos/hardware/sleep.nix index cd794a4..146e459 100644 --- a/modules/nixos/hardware/sleep.nix +++ b/modules/nixos/hardware/sleep.nix @@ -8,6 +8,10 @@ config = lib.mkIf (config.physical && !config.server) { + # Use power button to sleep instead of poweroff + services.logind.powerKey = "suspend"; + services.logind.powerKeyLongPress = "poweroff"; + # Prevent wake from keyboard powerManagement.powerDownCommands = '' set +e