From df0b0d2f147e1cad7683aba0545ac8291c2827d1 Mon Sep 17 00:00:00 2001 From: r-vdp Date: Sun, 8 Feb 2026 21:36:13 +0200 Subject: [PATCH] nixos/power-management: deprecate powerUpCommands Their ordering is ill-defined. Users are better off using an explicit systemd service. --- nixos/modules/config/power-management.nix | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/nixos/modules/config/power-management.nix b/nixos/modules/config/power-management.nix index 5dcfe5bf013c..b5ae488697a2 100644 --- a/nixos/modules/config/power-management.nix +++ b/nixos/modules/config/power-management.nix @@ -62,6 +62,19 @@ in config = lib.mkIf cfg.enable { + warnings = lib.optional (cfg.powerUpCommands != "") '' + powerManagement.powerUpCommands is deprecated due to it having unclear ordering semantics. + It will be removed in NixOS 26.11. + It is recommended to create an explicit systemd oneshot service instead, + that is pulled in at the right time during the boot process. + See https://www.freedesktop.org/software/systemd/man/latest/systemd.special.html + for more information on possible targets that can be used for this. + + If you also want to run this service upon waking up from resume, the recommended + method to do so is described here: + https://www.freedesktop.org/software/systemd/man/latest/systemd.special.html#sleep.target + ''; + systemd.targets.post-resume = { description = "Post-Resume Actions"; requires = [ "post-resume.service" ]; @@ -85,8 +98,8 @@ in description = "Post-boot Actions"; # It's not well defined at what point in the bootup sequence this should run # we should eventually just remove this. - after = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ]; + restartIfChanged = false; serviceConfig = { Type = "oneshot"; RemainAfterExit = true;