From 31556fc1c433951005b087001185a8526cf16325 Mon Sep 17 00:00:00 2001 From: Profpatsch Date: Wed, 16 Mar 2022 19:46:30 +0100 Subject: 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. --- modules/services/upower-minimal.nix | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'modules') 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 ; }; } -- cgit 1.4.1