From 18aa0c5687d9b047b06ad00132d6881bce1a74a0 Mon Sep 17 00:00:00 2001 From: Soispha Date: Mon, 31 Jul 2023 23:03:06 +0200 Subject: Fix(system/services/nix-sync): Make the timer relative to the unit start The timer before hand started `repo.interval` after it self was started, i.e., it was a oneshot timer. This change now fixes this by make the point the timer activates relative to the time elapsed, since the associated unit was last started. --- system/services/nix-sync/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/services/nix-sync') diff --git a/system/services/nix-sync/default.nix b/system/services/nix-sync/default.nix index 44348c0..482c268 100644 --- a/system/services/nix-sync/default.nix +++ b/system/services/nix-sync/default.nix @@ -10,7 +10,7 @@ description = "Nix sync ${name} timer"; wantedBy = ["timers.target"]; timerConfig = { - OnActiveSec = repo.interval; + OnUnitActiveSec = repo.interval; }; after = ["network-online.target"]; }; -- cgit 1.4.1 From 8d9ef95d74fe58302b7fff945162beb01c3e6d33 Mon Sep 17 00:00:00 2001 From: Soispha Date: Tue, 1 Aug 2023 23:58:16 +0200 Subject: Fix(system/services/nix-sync): Rebase on pulls, to allow for force pushes As the nix-sync service should _never_ commit new stuff, this rebase should always be a fast-forward, i.e. it works without manual intervention. Without the rebase as argument, this services would break, when the history gets rewritten, for example on a amended commit. --- system/services/nix-sync/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'system/services/nix-sync') diff --git a/system/services/nix-sync/default.nix b/system/services/nix-sync/default.nix index 482c268..cedbb91 100644 --- a/system/services/nix-sync/default.nix +++ b/system/services/nix-sync/default.nix @@ -37,7 +37,7 @@ branch="$(git rev-parse @)"; if ! [ "$origin" = "$branch" ]; then - git pull; + git pull --rebase; out_paths=$(mktemp); nix build . --print-out-paths --experimental-features 'nix-command flakes' > "$out_paths"; @@ -66,7 +66,7 @@ if ! [ -L ${esa repo.path} ]; then cd ${esa repoCachePath}; - git pull; + git pull --rebase; out_paths=$(mktemp); nix build . --print-out-paths --experimental-features 'nix-command flakes' > "$out_paths"; -- cgit 1.4.1 From dfb847a3c9d3bdd73aa187e590c239f3531f5e07 Mon Sep 17 00:00:00 2001 From: Soispha Date: Mon, 31 Jul 2023 18:27:09 +0200 Subject: Fix(system/services/nix-sync): Remove timeout on build The unit had the potential to fail, if the build took longer than the default timeout. This is obviously not ideal, so the timeout was removed, as all nix builds should be safe enough not to devour resources. --- system/services/nix-sync/default.nix | 1 + 1 file changed, 1 insertion(+) (limited to 'system/services/nix-sync') diff --git a/system/services/nix-sync/default.nix b/system/services/nix-sync/default.nix index cedbb91..8c466b8 100644 --- a/system/services/nix-sync/default.nix +++ b/system/services/nix-sync/default.nix @@ -88,6 +88,7 @@ preStart = execStartPreScript; serviceConfig = { + TimeoutSec = 0; ExecStart = execStartScript; Restart = "on-abort"; # User and group -- cgit 1.4.1