about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--hosts/by-name/apzu/configuration.nix7
-rw-r--r--modules/by-name/up/upower/module.nix23
2 files changed, 29 insertions, 1 deletions
diff --git a/hosts/by-name/apzu/configuration.nix b/hosts/by-name/apzu/configuration.nix
index 6fc917d3..a5b10e9f 100644
--- a/hosts/by-name/apzu/configuration.nix
+++ b/hosts/by-name/apzu/configuration.nix
@@ -39,7 +39,12 @@
       hostName = "apzu";
       mode = "NetworkManager";
     };
-    services.unison.foreign.address = "tiamat.fritz.box";
+
+    services = {
+      unison.foreign.address = "tiamat.fritz.box";
+      upower.enable = true;
+    };
+
     nixpkgs = {
       enable = true;
       systemName = "x86_64-linux";
diff --git a/modules/by-name/up/upower/module.nix b/modules/by-name/up/upower/module.nix
new file mode 100644
index 00000000..eb1c7af2
--- /dev/null
+++ b/modules/by-name/up/upower/module.nix
@@ -0,0 +1,23 @@
+{
+  config,
+  lib,
+  ...
+}: let
+  cfg = config.soispha.services.upower;
+in {
+  options.soispha.services.upower = {
+    enable = lib.mkEnableOption "upower";
+  };
+
+  config = lib.mkIf cfg.enable {
+    services.upower = {
+      enable = true;
+      usePercentageForPolicy = true;
+
+      percentageLow = 10;
+      percentageAction = 5;
+
+      criticalPowerAction = "Hibernate";
+    };
+  };
+}