power-button: module init

sh-initrd-on-root
Zynh Ludwig 2024-09-17 03:54:00 -07:00
parent eb4e36de4f
commit 9aa9ce6dfe
2 changed files with 21 additions and 0 deletions

View File

@ -14,4 +14,5 @@ in
snowhawk.audio.enable = lib.mkDefault true;
snowhawk.env.enable = lib.mkDefault true;
snowhawk.sops.enable = lib.mkDefault true;
snowhawk.power-button.enable = lib.mkDefault true;
}

20
modules/power-button.nix Normal file
View File

@ -0,0 +1,20 @@
{ config, lib }:
let
inherit (lib) mkIf mkEnableOption;
cfg = config.snowhawk.power-button;
in
{
options.snowhawk.power-button = {
enable = mkEnableOption "power-button nixos module";
};
config = mkIf cfg.enable {
services.logind = {
powerKey = "suspend";
powerKeyLongPress = "poweroff";
};
};
}