Add host setup script for Starship + JetBrainsMono Nerd Font

Pairs with the Terminal page's Nerd Font glyph fallback: run this on any VM you SSH into from ArchNest to get a full icon-rich Starship prompt, not just working icon rendering.
This commit is contained in:
Claude 2026-06-21 09:03:33 +00:00
parent f41b700904
commit 5ed6bb591f
No known key found for this signature in database

View file

@ -0,0 +1,73 @@
#!/usr/bin/env bash
# Installs Starship (the prompt) + JetBrainsMono Nerd Font (the icons) on a
# host you SSH into from ArchNest's Terminal page, and wires Starship into
# bash/zsh if either is present. Safe to re-run.
#
# This repo is private, so there's no public raw-URL one-liner. Run it directly
# on the target VM instead, as the user whose shell you want themed:
# scp scripts/install-starship-nerdfont.sh youruser@host:/tmp/
# ssh youruser@host 'bash /tmp/install-starship-nerdfont.sh'
# or paste its contents into a Terminal/SSH session and run it there.
set -euo pipefail
NERD_FONT_VERSION="v3.4.0"
NERD_FONT_NAME="JetBrainsMono"
FONT_DIR="${HOME}/.local/share/fonts/NerdFonts"
echo "==> Installing Starship"
if command -v starship >/dev/null 2>&1; then
echo " starship already installed ($(starship --version | head -1)), skipping"
else
curl -fsSL https://starship.rs/install.sh | sh -s -- -y
fi
echo "==> Installing ${NERD_FONT_NAME} Nerd Font into ${FONT_DIR}"
mkdir -p "${FONT_DIR}"
TMP_TAR="$(mktemp)"
curl -fsSL -o "${TMP_TAR}" \
"https://github.com/ryanoasis/nerd-fonts/releases/download/${NERD_FONT_VERSION}/${NERD_FONT_NAME}.tar.xz"
tar -xJf "${TMP_TAR}" -C "${FONT_DIR}"
rm -f "${TMP_TAR}"
if command -v fc-cache >/dev/null 2>&1; then
fc-cache -f "${FONT_DIR}" >/dev/null
fi
STARSHIP_INIT_BASH='eval "$(starship init bash)"'
STARSHIP_INIT_ZSH='eval "$(starship init zsh)"'
add_init_line() {
local rcfile="$1" line="$2"
[ -f "${rcfile}" ] || return 0
if ! grep -qF "${line}" "${rcfile}"; then
printf '\n# Added by ArchNest install-starship-nerdfont.sh\n%s\n' "${line}" >> "${rcfile}"
echo " added Starship init to ${rcfile}"
else
echo " ${rcfile} already initializes Starship, skipping"
fi
}
echo "==> Wiring Starship into shell rc files"
add_init_line "${HOME}/.bashrc" "${STARSHIP_INIT_BASH}"
add_init_line "${HOME}/.zshrc" "${STARSHIP_INIT_ZSH}"
mkdir -p "${HOME}/.config"
if [ ! -f "${HOME}/.config/starship.toml" ]; then
starship preset nerd-font-symbols -o "${HOME}/.config/starship.toml" 2>/dev/null \
|| echo " (preset command unavailable on this Starship version — using its built-in default prompt, which already includes icons)"
fi
cat <<EOF
Done.
Next steps:
1. In ArchNest's Terminal page, open Settings (gear icon) and pick a font —
any of the listed options now layers in icon glyphs automatically.
2. Open a NEW terminal session to this host (or run 'exec \$SHELL -l') to
pick up the new prompt — it won't apply to sessions already connected.
Font installed to: ${FONT_DIR}
Starship config: ${HOME}/.config/starship.toml
EOF