system/settings/configuration/auto-upgrade.nix (view raw)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | {
config,
pkgs,
...
}:
{
systemd.services.update-nixfiles = {
startAt = config.system.autoUpgrade.dates;
wantedBy = [ "nixos-upgrade.service" ];
path = with pkgs; [
openssh
nix
config.programs.git.package
];
serviceConfig = {
Type = "oneshot";
User = "alin";
WorkingDirectory = "${config.users.users.alin.home}/projects/alin.ovh/nixfiles";
};
script = ''
git checkout -- flake.lock
git pull --recurse-submodules=yes
'';
};
system.autoUpgrade = {
enable = true;
allowReboot = true;
dates = "02:10";
randomizedDelaySec = "59 min";
rebootWindow = {
lower = "01:00";
upper = "06:00";
};
flake = "${config.systemd.services.update-nixfiles.serviceConfig.WorkingDirectory}?submodules=1";
};
}
|