nixos/power-management: run postBootCommands in a systemd service instead of stage2-init.sh
This reduces our initrd script slightly, and we never made any clear ordering guarantees about when these commands run anyway. It also removes this as a blocker for nixos-init.
This commit is contained in:
@@ -81,6 +81,21 @@ in
|
||||
serviceConfig.Type = "oneshot";
|
||||
};
|
||||
|
||||
systemd.services.post-boot = {
|
||||
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" ];
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
RemainAfterExit = true;
|
||||
};
|
||||
script = ''
|
||||
${cfg.powerUpCommands}
|
||||
'';
|
||||
};
|
||||
|
||||
systemd.services.post-resume = {
|
||||
description = "Post-Resume Actions";
|
||||
# Pulled in by post-resume.service above
|
||||
|
||||
@@ -58,10 +58,6 @@ in
|
||||
assertion = config.boot.postBootCommands == "";
|
||||
message = "nixos-init cannot be used with boot.postBootCommands";
|
||||
}
|
||||
{
|
||||
assertion = config.powerManagement.powerUpCommands == "";
|
||||
message = "nixos-init cannot be used with powerManagement.powerUpCommands";
|
||||
}
|
||||
];
|
||||
})
|
||||
];
|
||||
|
||||
@@ -30,7 +30,6 @@ let
|
||||
);
|
||||
postBootCommands = pkgs.writeText "local-cmds" ''
|
||||
${config.boot.postBootCommands}
|
||||
${config.powerManagement.powerUpCommands}
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user