hosts/deploy.nix: use our consul package

This commit is contained in:
Max Headroom 2024-06-04 13:57:23 +02:00
parent 5b9d428f84
commit 57c2e69397

View file

@ -23,10 +23,10 @@ in
async = true; async = true;
deploy = { deploy = {
agents = callUpon hour; agents = callUpon hour;
rollbackScript = genAttrs systems (flip withSystem ({ pkgs, ... }: rollbackScript = genAttrs systems (flip withSystem ({ config, pkgs, ... }:
let let
scheduleReboot = pkgs.writeShellScript "schedule-reboot.sh" '' scheduleReboot = pkgs.writeShellScript "schedule-reboot.sh" ''
export PATH="${pkgs.consul}/bin:${pkgs.systemd}/bin:${pkgs.coreutils}/bin" export PATH="${config.packages.consul}/bin:${pkgs.systemd}/bin:${pkgs.coreutils}/bin"
currentTime=$(date +%s) currentTime=$(date +%s)
lastScheduledTime=$(consul kv get system/coordinated-reboot/last) lastScheduledTime=$(consul kv get system/coordinated-reboot/last)
if [[ $? -ne 0 ]]; then if [[ $? -ne 0 ]]; then
@ -46,7 +46,7 @@ in
ScheduleShutdown st reboot ''${nextScheduledTime}000000 ScheduleShutdown st reboot ''${nextScheduledTime}000000
''; '';
in pkgs.writeShellScript "post-effect.sh" '' in pkgs.writeShellScript "post-effect.sh" ''
export PATH="${pkgs.consul}/bin:${pkgs.coreutils}/bin" export PATH="${config.packages.consul}/bin:${pkgs.coreutils}/bin"
if [[ "$(realpath /run/booted-system/kernel)" != "$(realpath /nix/var/nix/profiles/system/kernel)" ]]; then if [[ "$(realpath /run/booted-system/kernel)" != "$(realpath /nix/var/nix/profiles/system/kernel)" ]]; then
echo "Scheduling reboot for kernel upgrade" echo "Scheduling reboot for kernel upgrade"
if ! consul members >/dev/null; then if ! consul members >/dev/null; then