From a726e22695ada34a3981040ff0175574050fc995 Mon Sep 17 00:00:00 2001 From: Grace Yoder Date: Fri, 2 Oct 2026 14:22:35 -0400 Subject: hamano stuff --- modules/auto-update.nix | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 modules/auto-update.nix (limited to 'modules/auto-update.nix') diff --git a/modules/auto-update.nix b/modules/auto-update.nix new file mode 100644 index 0000000..b370390 --- /dev/null +++ b/modules/auto-update.nix @@ -0,0 +1,26 @@ +{ pkgs, ... }: + +{ + system.autoUpgrade = { + enable = true; + dates = "minutely"; + allowReboot = true; + upgrade = false; + }; + + systemd.services.nixos-upgrade = { + path = [ pkgs.git ]; + serviceConfig = { + WorkingDirectory = "/etc/nixos"; + StateDirectory = "nixos-repo-update"; + ExecCondition = pkgs.writeShellScript "check-nixos-repo" '' + set -euo pipefail + git fetch || exit 255 + test "$(cat "$STATE_DIRECTORY/applied" 2>/dev/null || true)" != "$(git rev-parse '@{upstream}')" + ''; + }; + + preStart = "git pull --ff-only"; + postStart = ''git rev-parse HEAD > "$STATE_DIRECTORY/applied"''; + }; +} -- cgit v1.3.1