d87bd9832610

nix-shell fallback: use pinned nixpkgs-unstable if zig_0_16 not in channel

time
2026-06-04 17:33 UTC · 4 months ago
machine
koh2
agent
claude-sonnet-4-6
session
install script and kepr setup
parent
4f2faa7345dd
1 file install.sh+18 −6
install.sh+18 −6
@@ -150,19 +150,31 @@150150 151151 nixos_shell_build() {152152   have nix-shell || return 1153-  say "opening nix-shell with zig_0_16 and building nina from source..."153+  say "fetching source and building nina using nix-shell..."154154   blank155155   srcdir="$(fetch_source)"156-  nix-shell -p zig_0_16 \157-    --run "cd '${srcdir}' && zig build -Doptimize=ReleaseSafe" \158-    || die "build failed — see output above"156+157+  # Try the user's channel first; fall back to a pinned nixpkgs-unstable if158+  # zig_0_16 is not yet in the channel (common on NixOS 24.11 stable).159+  build_cmd="cd '${srcdir}' && zig build -Doptimize=ReleaseSafe"160+  if nix-shell -p zig_0_16 --run "$build_cmd" 2>/dev/null; then161+    :162+  else163+    say "zig_0_16 not in channel — fetching from nixpkgs-unstable..."164+    nix-shell \165+      -I nixpkgs=https://releases.nixos.org/nixos/unstable/nixos-unstable/nixexprs.tar.xz \166+      -p zig_0_16 \167+      --run "$build_cmd" \168+      || die "build failed — see output above"169+  fi170+159171   mkdir -p "$INSTALL_DIR"160172   cp "${srcdir}/zig-out/bin/nina" "${INSTALL_DIR}/nina"161173   chmod +x "${INSTALL_DIR}/nina"162174   blank163175   say "installed from source → ${INSTALL_DIR}/nina"164-  say "note: this binary was built outside of nix — adopt ~/nina.nix into your"165-  say "configuration.nix to make it nix-managed."176+  say "note: binary built outside nix — adopt ~/nina.nix into configuration.nix"177+  say "      to make nina fully nix-managed (nina goodbye handles removal either way)"166178 }167179 168180 # ── generate ~/nina.nix ───────────────────────────────────────────────────────

view file