From cc257a396b5ecbb624724c9ec76b0669a07a1f24 Mon Sep 17 00:00:00 2001 From: Evie Litherland-Smith Date: Tue, 16 May 2023 13:54:05 +0100 Subject: [PATCH] Initial add systemd timer to keep config repo up to date --- systemd/nixos-pull.nix | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 systemd/nixos-pull.nix diff --git a/systemd/nixos-pull.nix b/systemd/nixos-pull.nix new file mode 100644 index 00000000..02a8abd4 --- /dev/null +++ b/systemd/nixos-pull.nix @@ -0,0 +1,21 @@ +{ pkgs, ... }: +{ + systemd.timers."nixos-pull-config" = { + wantedBy = [ "timers.target" ]; + description = "Timer to update /etc/nixos/config/ repository"; + timerConfig = { + OnBootSec = "5m"; + OnUnitActiveSec = "5m"; + Unit = "hello-world.service"; + }; + }; + systemd.services."nixos-pull-config" = { + script = '' + ${pkgs.git}/bin/git pull -C /etc/nixos/config/ --ff-only --no-edit + ''; + serviceConfig = { + Type = "oneshot"; + User = "root"; + }; + }; +}