diff --git a/flake/scripts.nix b/flake/scripts.nix index 75f3ae3..e95c048 100644 --- a/flake/scripts.nix +++ b/flake/scripts.nix @@ -40,8 +40,9 @@ _: { sed -i -E "s|(agePublicKey\s*=\s*\")[^\"]*(\";)|\1$new_age_key\2|" "hosts/$host/default.nix" echo "==> Updating SOPS secrets..." - BW_SESSION="$(bw login --raw)" - export BW_SESSION + if BW_SESSION="$(bw login --raw)"; then + export BW_SESSION + fi SOPS_AGE_KEY="$(bw get item 'admin age-key' | jq -r '.notes')" export SOPS_AGE_KEY SOPS_CONFIG="$(nix build .#sops-config --print-out-paths)" diff --git a/flake/sops.nix b/flake/sops.nix index 1355c81..867ac34 100644 --- a/flake/sops.nix +++ b/flake/sops.nix @@ -50,8 +50,9 @@ pkgs.jq ]; shellHook = '' - BW_SESSION="$(bw login --raw)" - export BW_SESSION + if BW_SESSION="$(bw login --raw)"; then + export BW_SESSION + fi SOPS_AGE_KEY="$(bw get item 'admin age-key' | jq -r '.notes')" export SOPS_AGE_KEY SOPS_CONFIG="${self'.packages.sops-config}"