diff --git a/hosts/ornithologist/default.nix b/hosts/ornithologist/default.nix index ae36071..9b00f9a 100644 --- a/hosts/ornithologist/default.nix +++ b/hosts/ornithologist/default.nix @@ -7,4 +7,31 @@ # Enable docker. flock.docker.enable = true; + + # Deploy NixOS updates once a week. + systemd.timers."deploy-rs" = { + wantedBy = ["timers.target"]; + timerConfig = { + OnCalendar = "weekly"; + Persistent = true; + Unit = "deploy-rs.service"; + }; + }; + + systemd.services."deploy-rs" = { + path = with pkgs; [openssh git nix deploy-rs]; + script = '' + set -eu + + cd /home/fern/Repositories/flock + git pull && nix flake update + + deploy && git commit -m "[ornithologist] Update flake.lock" && git push + ''; + serviceConfig = { + Type = "oneshot"; + User = "fern"; + Group = "users"; + }; + }; }