lib/autoupdate: cap running time with TimeoutStartSec

This commit is contained in:
Astro 2022-01-12 20:15:55 +01:00
parent 5e8a1fa12f
commit ac7b628e8c
1 changed files with 6 additions and 1 deletions

View File

@ -20,7 +20,12 @@
systemd.services.autoupdate = {
wantedBy = [ "multi-user.target" ];
path = with pkgs; [ nixFlakes nettools curl jq ];
serviceConfig.Type = "oneshot";
serviceConfig = {
Type = "oneshot";
# switch-to-configuration may not return. HACK: cap running
# time so that the timer can be scheduled again.
TimeoutStartSec = "30min";
};
script = ''
OLD=$(readlink /run/current-system)
NEW=$(curl -sLH "Accept: application/json" https://hydra.hq.c3d2.de/job/c3d2/nix-config/x86_64-linux.$(hostname)/latest | jq -r .buildoutputs.out.path)