From f477370e4cf14179bc19989345d03fd438257f15 Mon Sep 17 00:00:00 2001 From: Colin Date: Wed, 12 Jun 2024 22:47:06 +0000 Subject: [PATCH] scripts/deploy: add more logging --- scripts/deploy | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/scripts/deploy b/scripts/deploy index eb28d82b..52222cdf 100755 --- a/scripts/deploy +++ b/scripts/deploy @@ -15,6 +15,10 @@ usage() { exit 1 } +info() { + echo "[deploy]" "$@" +} + action=switch host=$(hostname) variant= @@ -69,8 +73,10 @@ deployOneHost() { local host="$1" local variant="$2" + info "building $host$variant ..." nix-build -A "hosts.$host$variant.toplevel" --out-link "./build/result-$host$variant" "${nixArgs[@]}" || return 1 storePath="$(readlink ./build/result-$host$variant)" + info "build $host$variant -> $storePath" # mimic `nixos-rebuild --target-host`, in effect: # - nix-copy-closure ... @@ -83,9 +89,10 @@ deployOneHost() { if [ -n "$host" ]; then if [ -e /run/secrets/nix_signing_key ]; then + info "signing store paths ..." sudo nix store sign -r -k /run/secrets/nix_signing_key "$storePath" else - echo "not signing store paths: /run/secrets/nix_signing_key does not exist" + info "not signing store paths: /run/secrets/nix_signing_key does not exist" fi # add more `-v` for more verbosity (up to 5). # builders-use-substitutes false: optimizes so that the remote machine doesn't try to get paths from its substituters. @@ -94,6 +101,7 @@ deployOneHost() { fi if [ -n "$action" ] && [ "$action" != "copy" ]; then + info "activating profile... " runOnTarget sudo nix-env -p /nix/var/nix/profiles/system --set "$storePath" || return 1 runOnTarget sudo "$storePath/bin/switch-to-configuration" "$action" || return 1 fi