From 024461fcfb03981ccb474b2361d4b1a42586b5e5 Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Thu, 18 Dec 2025 13:54:30 -0500 Subject: Telegram formatting + push.sh Tailscale support - Strengthen Telegram MarkdownV2 formatting guidance in Ava's system prompt - Add DNS record beryl.bensima.com -> 100.127.197.132 (Tailscale IP) - Modify push.sh to detect local deploys and skip SSH - Add Tailscale hostname fallback when domain is unreachable --- Omni/Ide/push.sh | 65 ++++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 47 insertions(+), 18 deletions(-) (limited to 'Omni/Ide/push.sh') diff --git a/Omni/Ide/push.sh b/Omni/Ide/push.sh index f6d67f4..a713e46 100755 --- a/Omni/Ide/push.sh +++ b/Omni/Ide/push.sh @@ -48,24 +48,53 @@ nixos_deploy() { # hack: get the domain from the systemd service where=$(rg --only-matching --replace '$2' --regexp '(domainname ")(.*)(")' \ "$what/etc/systemd/system/domainname.service") - nix copy --to ssh://"$USER"@"$where" "$what" - ssh "$USER"@"$where" sudo nix-env --profile /nix/var/nix/profiles/system --set "$what" - switch_cmd=( - systemd-run - -E LOCALE_ARCHIVE - --setenv=XDG_RUNTIME_DIR="" - --collect - --no-ask-password - --pipe - --quiet - --service-type=exec - --unit=push-switch-to-configuration - --wait - "$what/bin/switch-to-configuration" - "switch" - ) - # shellcheck disable=SC2029 - ssh "$USER"@"$where" sudo "${switch_cmd[@]}" + + # Check if we're deploying to ourselves (local deploy) + # Extract hostname from NixOS config path (e.g., Omni.Dev.Beryllium.nix -> beryllium) + local current_hostname + current_hostname=$(hostname) + local config_hostname + config_hostname=$(echo "$target" | sed -E 's/.*\.([^.]+)\.nix$/\1/' | tr '[:upper:]' '[:lower:]') + + if [[ "$current_hostname" == "$config_hostname" ]] || [[ "$where" == "localhost" ]]; then + echo -e "${YLW}info: push: local deploy detected${NC}" + sudo nix-env --profile /nix/var/nix/profiles/system --set "$what" + switch_cmd=( + "$what/bin/switch-to-configuration" + "switch" + ) + sudo "${switch_cmd[@]}" + else + # Try domain first, fall back to Tailscale hostname (config_hostname) + local ssh_target="$USER@$where" + if ! ssh -o ConnectTimeout=5 -o BatchMode=yes "$ssh_target" true 2>/dev/null; then + echo -e "${YLW}info: push: $where unreachable, trying Tailscale hostname $config_hostname${NC}" + ssh_target="$USER@$config_hostname" + if ! ssh -o ConnectTimeout=5 -o BatchMode=yes "$ssh_target" true 2>/dev/null; then + echo -e "${RED}fail: push: cannot reach $where or $config_hostname${NC}" + exit 1 + fi + fi + + nix copy --to ssh://"$ssh_target" "$what" + ssh "$ssh_target" sudo nix-env --profile /nix/var/nix/profiles/system --set "$what" + switch_cmd=( + systemd-run + -E LOCALE_ARCHIVE + --setenv=XDG_RUNTIME_DIR="" + --collect + --no-ask-password + --pipe + --quiet + --service-type=exec + --unit=push-switch-to-configuration + --wait + "$what/bin/switch-to-configuration" + "switch" + ) + # shellcheck disable=SC2029 + ssh "$ssh_target" sudo "${switch_cmd[@]}" + fi echo -e "${GRN}good: push: $target${NC}" } -- cgit v1.2.3