summaryrefslogtreecommitdiff
path: root/os/common
diff options
context:
space:
mode:
Diffstat (limited to 'os/common')
-rw-r--r--os/common/configuration.nix8
1 files changed, 7 insertions, 1 deletions
diff --git a/os/common/configuration.nix b/os/common/configuration.nix
index 047b153..8026b9f 100644
--- a/os/common/configuration.nix
+++ b/os/common/configuration.nix
@@ -1,4 +1,4 @@
-{ config, lib, ... }: let
+{ config, pkgs, lib, ... }: let
host = config.networking.hostName;
in {
disabledModules = [
@@ -23,6 +23,12 @@ in {
size = 2048; # 2GB
}];
+ services.udev.extraRules = let
+ cmd = "${pkgs.systemd}/bin/systemctl hibernate";
+ in ''
+ SUBSYSTEM=="power_supply", ATTR{status}=="Discharging", ATTR{capacity}=="[0-5]", RUN+="${cmd}"
+ '';
+
sops = {
defaultSopsFile = ../${host}/secrets.yaml;
age.keyFile = "/var/secrets/${host}.sops";