all repos — nixfiles @ ba08cd95da1d9198b898678f5d1159f825baaf14

System and user configuration, managed by nix and home-manager

make all servers auto-upgrade

Alin
commit

ba08cd95da1d9198b898678f5d1159f825baaf14

parent

6c1a3d2a6e370b956d2397a5302058bed3a0cf71

1 file changed, 40 insertions(+), 0 deletions(-)

changed files
A system/settings/configuration/auto-upgrade.nix
@@ -0,0 +1,40 @@
+{ + 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 + nix flake update + ''; + }; + + 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"; + }; +}