Skip to content

Commit 7e0a3b2

Browse files
authored
nix install for non debian based linux (#1472)
1 parent 3d6cecb commit 7e0a3b2

File tree

1 file changed

+40
-8
lines changed

1 file changed

+40
-8
lines changed

scripts/install.sh

Lines changed: 40 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ detect_os() {
321321
if grep -qi microsoft /proc/version 2>/dev/null; then DETECTED_OS="wsl"
322322
elif [[ -f /etc/NIXOS ]] || has_cmd nixos-version; then DETECTED_OS="nixos"
323323
elif grep -qEi 'debian|ubuntu' /etc/os-release 2>/dev/null; then DETECTED_OS="ubuntu"
324-
else die "unsupported Linux distribution (only Debian/Ubuntu-based distros supported)"; fi
324+
else DETECTED_OS="linux"; fi
325325
DETECTED_OS_VERSION="$(. /etc/os-release 2>/dev/null && echo "${VERSION_ID:-unknown}" || echo "unknown")"
326326
else
327327
die "unsupported operating system: $uname_s"
@@ -377,6 +377,10 @@ print_sysinfo() {
377377
macos) os_display="macOS ${DETECTED_OS_VERSION} (${DETECTED_ARCH})" ;;
378378
nixos) os_display="NixOS ${DETECTED_OS_VERSION} (${DETECTED_ARCH})" ;;
379379
wsl) os_display="WSL2 / Ubuntu ${DETECTED_OS_VERSION} (${DETECTED_ARCH})" ;;
380+
linux)
381+
local distro_name
382+
distro_name="$(. /etc/os-release 2>/dev/null && echo "${PRETTY_NAME:-Linux}" || echo "Linux")"
383+
os_display="${distro_name} (${DETECTED_ARCH})" ;;
380384
*) os_display="Unknown" ;;
381385
esac
382386
case "$DETECTED_GPU" in
@@ -411,8 +415,13 @@ install_nix() {
411415
printf "\n"
412416

413417
if ! prompt_confirm "Install Nix now? (official nixos.org multi-user installer)" "yes"; then
414-
warn "skipping Nix installation — falling back to system packages"
415-
SETUP_METHOD="system"
418+
if [[ "$DETECTED_OS" == "linux" ]]; then
419+
warn "skipping Nix — see https://github.com/dimensionalOS/dimos/?tab=readme-ov-file#installation"
420+
SETUP_METHOD="manual"
421+
else
422+
warn "skipping Nix installation — falling back to system packages"
423+
SETUP_METHOD="system"
424+
fi
416425
return
417426
fi
418427

@@ -442,14 +451,29 @@ install_nix() {
442451
}
443452

444453
prompt_setup_method() {
445-
if [[ "$NO_NIX" == "1" ]]; then SETUP_METHOD="system"; return; fi
454+
if [[ "$NO_NIX" == "1" ]]; then
455+
if [[ "$DETECTED_OS" == "linux" ]]; then SETUP_METHOD="manual"
456+
else SETUP_METHOD="system"; fi
457+
return
458+
fi
446459
if [[ "$USE_NIX" == "1" ]]; then
447460
[[ "$HAS_NIX" == "1" ]] && { ok "Nix detected — using for system deps"; SETUP_METHOD="nix"; USE_NIX=1; return; }
448461
install_nix; SETUP_METHOD="nix"; USE_NIX=1; return
449462
fi
450463

451464
local choice
452-
if [[ "$HAS_NIX" == "1" ]]; then
465+
if [[ "$DETECTED_OS" == "linux" ]]; then
466+
if [[ "$HAS_NIX" == "1" ]]; then
467+
prompt_select "How should we set up system dependencies?" \
468+
"Nix — nix develop (recommended for your distro)" \
469+
"Manual — skip, install dependencies yourself"
470+
else
471+
prompt_select "How should we set up system dependencies?" \
472+
"Install Nix — nix develop (recommended for your distro)" \
473+
"Manual — skip, install dependencies yourself"
474+
fi
475+
choice="$PROMPT_RESULT"
476+
elif [[ "$HAS_NIX" == "1" ]]; then
453477
prompt_select "How should we set up system dependencies?" \
454478
"System packages — apt/brew (simpler)" \
455479
"Nix — nix develop (reproducible)"
@@ -467,6 +491,9 @@ prompt_setup_method() {
467491
*Nix*|*nix*)
468492
[[ "$HAS_NIX" != "1" ]] && install_nix
469493
SETUP_METHOD="nix"; USE_NIX=1; ok "will use Nix for system dependencies" ;;
494+
*Manual*)
495+
SETUP_METHOD="manual"
496+
info "see https://github.com/dimensionalOS/dimos/?tab=readme-ov-file#installation" ;;
470497
*)
471498
SETUP_METHOD="system"; ok "will use system package manager" ;;
472499
esac
@@ -537,6 +564,11 @@ install_system_deps() {
537564
info "NixOS detected — system deps managed via nix develop"
538565
warn "you declined Nix setup; run 'nix develop' manually for system deps"
539566
;;
567+
linux)
568+
info "see https://github.com/dimensionalOS/dimos/?tab=readme-ov-file#installation"
569+
warn "install system dependencies manually, then re-run this script"
570+
return
571+
;;
540572
esac
541573
ok "system dependencies ready"
542574
}
@@ -928,13 +960,13 @@ main() {
928960
local ver_major; ver_major="$(echo "$DETECTED_OS_VERSION" | cut -d. -f1)"
929961
[[ "$ver_major" -lt 22 ]] 2>/dev/null && warn "Ubuntu ${DETECTED_OS_VERSION} — 22.04+ recommended"
930962
fi
931-
[[ "$DETECTED_OS" == "macos" ]] && {
963+
if [[ "$DETECTED_OS" == "macos" ]]; then
932964
local mac_major; mac_major="$(echo "$DETECTED_OS_VERSION" | cut -d. -f1)"
933965
[[ "$mac_major" -lt 12 ]] 2>/dev/null && die "macOS ${DETECTED_OS_VERSION} too old — 12.6+ required"
934-
}
966+
fi
935967

936968
prompt_setup_method
937-
[[ "$SETUP_METHOD" != "nix" ]] && install_system_deps
969+
if [[ "$SETUP_METHOD" != "nix" ]]; then install_system_deps; fi
938970
install_uv
939971

940972
if [[ -z "$DETECTED_PYTHON" ]]; then

0 commit comments

Comments
 (0)