create workaround for only first of multiple consecutive updates being applied

This commit is contained in:
bit 2025-08-22 17:07:32 +02:00
parent a44fd5e362
commit 4fa6f97f49

View File

@ -18,9 +18,7 @@
... ...
}: }:
'' ''
#!/usr/bin/env bash do_update() {
set -e
hostname=$(${hostname}) hostname=$(${hostname})
new_system=$(nix build --no-link --print-out-paths "${cfg.flake}#nixosConfigurations.''${hostname}.config.system.build.toplevel") new_system=$(nix build --no-link --print-out-paths "${cfg.flake}#nixosConfigurations.''${hostname}.config.system.build.toplevel")
@ -106,7 +104,7 @@
echo "last system update: $(${date} -d @"$system_update_time")" echo "last system update: $(${date} -d @"$system_update_time")"
echo "last flake update: $(${date} -d @"$flake_update_time")" echo "last flake update: $(${date} -d @"$flake_update_time")"
if [[ "$system_update_time" -gt "$flake_update_time" ]] if [[ -z "$1" ]] && [[ "$system_update_time" -gt "$flake_update_time" ]]
then then
echo "" echo ""
echo "System is newer than remote!" echo "System is newer than remote!"
@ -182,4 +180,12 @@
fi fi
"''${new_system}/bin/switch-to-configuration" "boot" "''${new_system}/bin/switch-to-configuration" "boot"
fi fi
}
if do_update
then
while true
do
do_update "forced"
done
fi
'' ''