about summary refs log tree commit diff
path: root/nixos/modules/services/hardware/upower.nix
diff options
context:
space:
mode:
authorMatthew Harm Bekkema <id@mbekkema.name>2019-12-03 20:50:42 +1100
committerMatthew Harm Bekkema <id@mbekkema.name>2019-12-04 12:26:30 +1100
commitf83a83f964a9894a837788d0253888187cfa4778 (patch)
treec2fe2c3536873b58bb40f116918a53e33d3957b0 /nixos/modules/services/hardware/upower.nix
parentaecfea098e17eaf5cd4a80fab440e0e29b12420c (diff)
upower: load config from /etc
In the process of making UPower.conf customizable (#73968), it came up
that UPower doesn't load its config from /etc by default.

The UPower derivation is modified to make it load its config from /etc
at runtime, but still install the default config to its nix store path
as before.

The UPower module is modified to put the config in /etc.
Diffstat (limited to 'nixos/modules/services/hardware/upower.nix')
-rw-r--r--nixos/modules/services/hardware/upower.nix29
1 files changed, 13 insertions, 16 deletions
diff --git a/nixos/modules/services/hardware/upower.nix b/nixos/modules/services/hardware/upower.nix
index 5713bfb15fd33..449810b53150f 100644
--- a/nixos/modules/services/hardware/upower.nix
+++ b/nixos/modules/services/hardware/upower.nix
@@ -220,22 +220,19 @@ in
 
     systemd.packages = [ cfg.package ];
 
-    systemd.services.upower.environment.UPOWER_CONF_FILE_NAME = pkgs.writeTextFile {
-      name = "UPower.conf";
-      text = generators.toINI {} {
-        UPower = {
-          EnableWattsUpPro = cfg.enableWattsUpPro;
-          NoPollBatteries = cfg.noPollBatteries;
-          IgnoreLid = cfg.ignoreLid;
-          UsePercentageForPolicy = cfg.usePercentageForPolicy;
-          PercentageLow = cfg.percentageLow;
-          PercentageCritical = cfg.percentageCritical;
-          PercentageAction = cfg.percentageAction;
-          TimeLow = cfg.timeLow;
-          TimeCritical = cfg.timeCritical;
-          TimeAction = cfg.timeAction;
-          CriticalPowerAction = cfg.criticalPowerAction;
-        };
+    environment.etc."UPower/UPower.conf".text = generators.toINI {} {
+      UPower = {
+        EnableWattsUpPro = cfg.enableWattsUpPro;
+        NoPollBatteries = cfg.noPollBatteries;
+        IgnoreLid = cfg.ignoreLid;
+        UsePercentageForPolicy = cfg.usePercentageForPolicy;
+        PercentageLow = cfg.percentageLow;
+        PercentageCritical = cfg.percentageCritical;
+        PercentageAction = cfg.percentageAction;
+        TimeLow = cfg.timeLow;
+        TimeCritical = cfg.timeCritical;
+        TimeAction = cfg.timeAction;
+        CriticalPowerAction = cfg.criticalPowerAction;
       };
     };
   };