commit daf172789182e6019e60e82ebc248ff7e639a72b parent f282a998d976bea2f6f91c74d8b9f1173917e0fd Author: Vincent Demeester <vincent@sbr.pm> Date: Sat, 9 May 2020 22:44:09 +0200 nix-auto-update: add a daily git pull Signed-off-by: Vincent Demeester <vincent@sbr.pm> Diffstat:
M | modules/profiles/nix-auto-update.nixos.nix | | | 20 | +++++++++++++++++++- |
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/modules/profiles/nix-auto-update.nixos.nix b/modules/profiles/nix-auto-update.nixos.nix @@ -53,12 +53,30 @@ in script = '' export PATH=/run/current-system/sw/bin cd /etc/nixos/ - runuser -l vincent -c 'git pull --autostash --rebase' make update switch ''; startAt = cfg.dates; onFailure = [ "status-email-root@%n.service" ]; }; + systemd.services.etc-nixos-git-update = { + description = "Update NixOS source git repository"; + unitConfig.X-StopOnRemoval = false; + restartIfChanged = false; + serviceConfig.Type = "oneshot"; + serviceConfig.User = "vincent"; + environment = config.nix.envVars + // { + inherit (config.environment.sessionVariables) NIX_PATH; + }; + path = [ pkgs.gnutar pkgs.xz pkgs.git ]; + script = '' + export PATH=/run/current-system/sw/bin + cd /etc/nixos/ + git pull --rebase --autostash --recurse-submodules + ''; + startAt = "daily"; + onFailure = [ "status-email-root@%n.service" ]; + }; } ) ]