feat: add preStart hook for nixos-upgrade service
Introduce a preStart hook to the nixos-upgrade systemd service to ensure the local repository is updated before upgrades by fetching and resetting to the origin's HEAD. This enhances the reliability and consistency of the upgrade process. Also, maintain the commented out old flake path for backward traceability.
This commit is contained in:
parent
82c7352bc2
commit
cd99b128d4
|
@ -37,10 +37,18 @@
|
|||
dates = "04:00";
|
||||
operation = "switch";
|
||||
allowReboot = true;
|
||||
# flake = lib.mkForce "git+file:///var/lib/gitea/repositories/harald/nixcfg.git#mx";
|
||||
# flake = lib.mkForce "git+file:///var/lib/gitea/repositories/harald/nixcfg.git#mx";
|
||||
flake = lib.mkForce "/root/nixcfg/.#mx";
|
||||
};
|
||||
|
||||
systemd.services.nixos-upgrade = {
|
||||
preStart = ''
|
||||
cd /root
|
||||
git fetch origin
|
||||
git reset --hard origin/HEAD
|
||||
'';
|
||||
};
|
||||
|
||||
nix.gc = {
|
||||
dates = "daily";
|
||||
options = "--delete-older-than 7d";
|
||||
|
|
Loading…
Reference in a new issue