From dd11a30bf357ffdd873e78484fa2c5cd56c2a90c Mon Sep 17 00:00:00 2001 From: Fern Garden Date: Thu, 18 Sep 2025 13:17:06 +0800 Subject: [PATCH] deploy-rs service --- hosts/ornithologist/default.nix | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) 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"; + }; + }; }