about summary refs log tree commit diff
path: root/modules
diff options
context:
space:
mode:
authorProfpatsch <mail@profpatsch.de>2022-03-16 19:46:30 +0100
committerProfpatsch <mail@profpatsch.de>2022-03-16 19:46:30 +0100
commit31556fc1c433951005b087001185a8526cf16325 (patch)
treec9143044de55c90cd7a9de2e3d47dacc20b5a889 /modules
parent62824c992a0c3371c4701e6d3080721811950b02 (diff)
modules/upower: add a reload trigger if the config changes
We should restart the service if its config changes. Since the service
file from the upstream distribution is used, we have to manually add a
trigger for that to happen.
Diffstat (limited to 'modules')
-rw-r--r--modules/services/upower-minimal.nix9
1 files changed, 6 insertions, 3 deletions
diff --git a/modules/services/upower-minimal.nix b/modules/services/upower-minimal.nix
index 25de830d..215e47dc 100644
--- a/modules/services/upower-minimal.nix
+++ b/modules/services/upower-minimal.nix
@@ -20,6 +20,8 @@ let
     ];
   });
 
+  configFile = ini.generate "UPower.conf" cfg.settings;
+
 in
 
 {
@@ -66,7 +68,6 @@ in
 
   config = lib.mkIf cfg.enable {
 
-
     # this is … questionable … l o w  e f f o r t
 
     environment.systemPackages = [ pkg ];
@@ -77,8 +78,10 @@ in
 
     systemd.packages = [ pkg ];
 
-    environment.etc."UPower/UPower.conf".source =
-      ini.generate "UPower.conf" cfg.settings;
+    # this implicitly assumes the package has a `upower.service` unit file
+    systemd.services."upower".restartTriggers = [ configFile ];
+
+    environment.etc."UPower/UPower.conf".source = configFile ;
   };
 
 }