From 0ceda0b6759908764083d8f8d5cb6f762016309d Mon Sep 17 00:00:00 2001 From: Doloro1978 Date: Sat, 14 Mar 2026 11:08:36 +0000 Subject: [PATCH] battery/ac target fixes (wip, still needs work) --- config/hosts/aspects/doloro-laptop/home.nix | 2 +- .../power-management/battery-ac-targets.nix | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/config/hosts/aspects/doloro-laptop/home.nix b/config/hosts/aspects/doloro-laptop/home.nix index 983743d..422aaa5 100644 --- a/config/hosts/aspects/doloro-laptop/home.nix +++ b/config/hosts/aspects/doloro-laptop/home.nix @@ -44,7 +44,7 @@ }; home.packages = with pkgs; [ telegram-desktop - legcord + equibop obsidian ]; nixpkgs.config.allowUnfree = true; diff --git a/config/modules/power-management/battery-ac-targets.nix b/config/modules/power-management/battery-ac-targets.nix index c277697..ab42b02 100644 --- a/config/modules/power-management/battery-ac-targets.nix +++ b/config/modules/power-management/battery-ac-targets.nix @@ -8,6 +8,20 @@ SUBSYSTEM=="power_supply",ENV{POWER_SUPPLY_ONLINE}=="0", RUN+="/run/current-system/systemd/bin/systemctl start battery.target" SUBSYSTEM=="power_supply", ENV{POWER_SUPPLY_ONLINE}=="1", RUN+="/run/current-system/systemd/bin/systemctl start ac.target" ''; + systemd.targets = { + "ac" = { + description = "On AC power"; + unitConfig = { + StopWhenUnneeded = "yes"; + }; + }; + "battery" = { + description = "On battery power"; + unitConfig = { + StopWhenUnneeded = "yes"; + }; + }; + }; }; }; }