1ea6dc71d2a4
install.sh: offer to enable nix features after install — maybe_setup_features probes 'nix eval --expr 1' (needs nix-command); if off, prompts 'enable them now? [Y/n]' read from /dev/tty (works under curl|sh) and runs the freshly-installed 'nina setup' on yes, else points to 'nina setup'; wired into all install paths, self-gates on 'have nix' and already-enabled. sh -n clean; verified probe skips on kyoshi (features on) and 'nina setup' reports 'all set' non-destructively
- time
- 2026-06-05 13:04 UTC · 4 months ago
- machine
- koh2
- agent
- claude-opus-4-8
- session
- nina finishing brief
- parent
- 4871502e9c71
↓ nina-1ea6dc71.tar.gzatlas at this save
files changed1 file
install.sh+33 −0install.sh+33 −0
@@ -287,6 +287,35 @@287287 esac288288 }289289 290+# ── enable nix experimental features ──────────────────────────────────────────291+# nina needs nix-command + flakes to search and install. If they're off, offer to292+# turn them on via the freshly-installed `nina setup`. Read from /dev/tty so the293+# prompt works even under `curl … | sh`, where stdin is the script itself.294+295+maybe_setup_features() {296+ have nix || return 0297+ # `nix eval` itself requires nix-command, so this doubles as the feature probe.298+ nix eval --expr '1' >/dev/null 2>&1 && return 0299+300+ NINA="${INSTALL_DIR}/nina"301+ [ -x "$NINA" ] || NINA="nina"302+303+ blank304+ say "nina needs nix's experimental features (nix-command and flakes) to"305+ say "search and install packages."306+307+ if [ -r /dev/tty ]; then308+ printf 'nina: enable them now? [Y/n] ' > /dev/tty309+ IFS= read -r ans < /dev/tty 2>/dev/null || ans="y"310+ case "$ans" in311+ [Nn]*) say "skipped — enable later with: nina setup"; return 0 ;;312+ esac313+ "$NINA" setup || say "automatic setup failed — run: nina setup"314+ else315+ say "run nina setup to enable them"316+ fi317+}318+290319 # ── closing message ──────────────────────────────────────────────────────────291320 292321 farewell() {@@ -306,12 +335,14 @@306335 say "NixOS detected"307336 if nixos_profile_install; then308337 generate_nixos_module338+ maybe_setup_features309339 farewell310340 exit 0311341 fi312342 nixos_shell_build313343 generate_nixos_module314344 check_path345+ maybe_setup_features315346 farewell316347 exit 0317348 fi@@ -319,6 +350,7 @@319350 # macOS / generic Linux: download binary, fall back to source build320351 if install_binary; then321352 check_path353+ maybe_setup_features322354 farewell323355 exit 0324356 fi@@ -326,4 +358,5 @@326358 say "no pre-built binary for ${platform} — falling back to source build"327359 build_from_source328360 check_path361+maybe_setup_features329362 farewell