install.sh

1.8 KB · raw

1#!/bin/sh2set -e34# ANSI color codes — empty when stdout/stderr is not a terminal5if [ -t 2 ]; then6  BOLD='\033[1m'7  DIM='\033[2m'8  CYAN='\033[36m'9  GREEN='\033[32m'10  YELLOW='\033[33m'11  RESET='\033[0m'12else13  BOLD='' DIM='' CYAN='' GREEN='' YELLOW='' RESET=''14fi1516INSTALL_CMD="nix profile add https://kepr.uk/nina/archive/HEAD.tar.gz"1718banner() {19  printf >&2 '\n'20  printf >&2 "${CYAN}        _${RESET}\n"21  printf >&2 "${CYAN}  _ __ (_)_ __   __ _${RESET}\n"22  printf >&2 "${CYAN} | '_ \\| | '_ \\ / _\` |${RESET}\n"23  printf >&2 "${CYAN} | | | | | | | | (_| |${RESET}\n"24  printf >&2 "${CYAN} |_| |_|_|_| |_|\\__,_|${RESET}\n"25  printf >&2 '\n'26  printf >&2 "  ${BOLD}NixOS Intuitive Navigation Assistant${RESET}  ${DIM}·${RESET}  ${DIM}kepr.uk/nina${RESET}\n"27  printf >&2 '\n'28}2930main() {31  banner3233  printf >&2 "  nina is installed directly with nix:\n\n"34  printf >&2 "    ${YELLOW}%s${RESET}\n\n" "$INSTALL_CMD"3536  # Always prompt via /dev/tty so this works when piped through curl | sh37  printf >&2 "  Run it now? [Y/n] "38  read -r answer </dev/tty39  case "${answer:-y}" in40    [nN]*)41      printf >&2 '\n  Copy the command above and run it whenever you are ready.\n\n'42      exit 043      ;;44  esac45  printf >&2 '\n'4647  nix profile add https://kepr.uk/nina/archive/HEAD.tar.gz4849  printf >&2 '\n'50  printf >&2 "  ${GREEN}${BOLD}✓ Thank you for installing nina!${RESET}\n"51  printf >&2 '\n'52  printf >&2 "  ${BOLD}Getting started${RESET}\n\n"53  printf >&2 "    ${CYAN}nina help${RESET}       — explore what nina can do\n"54  printf >&2 "    ${CYAN}nina goodbye${RESET}    — remove nina cleanly if it's not a good fit\n"55  printf >&2 '\n'56  printf >&2 "  ${BOLD}Issues & feedback${RESET}\n\n"57  printf >&2 "    ${DIM}https://${RESET}kepr.uk/nina   ${DIM}— no account required${RESET}\n"58  printf >&2 '\n'59}6061main