use execstart for update service

This commit is contained in:
Noa Aarts 2025-05-09 09:30:12 +02:00
parent 390cdd8fae
commit 40c48532b6
Signed by: noa
GPG key ID: 1850932741EFF672
2 changed files with 5 additions and 9 deletions

View file

@ -70,13 +70,12 @@
services."update-from-flake" = { services."update-from-flake" = {
path = with pkgs; [ path = with pkgs; [
nixos-rebuild
git git
]; ];
script = ''nixos-rebuild switch --flake github:itepastra/nixconf'';
serviceConfig = { serviceConfig = {
Type = "oneshot"; Type = "exec";
User = "root"; User = "root";
ExecStart = "${pkgs.nixos-rebuild-ng}/bin/nixos-rebuild switch --flake github:itepastra/nixconf";
}; };
wants = [ wants = [
"network-online.target" "network-online.target"

View file

@ -117,16 +117,13 @@ in
systemd.services = { systemd.services = {
"update-from-flake" = { "update-from-flake" = {
path = with pkgs; [ path = with pkgs; [
nixos-rebuild
git git
]; ];
script = ''
nixos-rebuild boot --flake github:itepastra/nixconf#nuOS
shutdown -r +5 "System will reboot in 5 minutes"
'';
serviceConfig = { serviceConfig = {
Type = "oneshot"; Type = "exec";
User = "root"; User = "root";
ExecStart = "${pkgs.nixos-rebuild-ng}/bin/nixos-rebuild boot --flake github:itepastra/nixconf";
ExecStopPost = ''shutdown -r +5 "Preparing update finished, rebooting..."'';
}; };
wants = [ wants = [
"network-online.target" "network-online.target"