From 03e1ae527b026b70d61fc1d51cc3ab9e4d1d6e16 Mon Sep 17 00:00:00 2001 From: Eduard Wisch Date: Mon, 20 Apr 2026 17:00:06 +0200 Subject: [PATCH] fix: Installer nutzt 'nix profile' statt nix-env wenn Profil inkompatibel Auf aktuellen NixOS-Systemen mit flakes ist das Default-Profil unter ~/.local/state/nix/profiles/profile inkompatibel mit nix-env. Der Installer erkennt jetzt den Profil-Typ (nix profile list) und nutzt den passenden Befehl (nix profile install / nix-env -i). --- install.sh | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/install.sh b/install.sh index 81789c7..91d4514 100644 --- a/install.sh +++ b/install.sh @@ -40,11 +40,22 @@ err() { echo "${RED}✗${RST} $*" >&2; exit 1; } # --- 1. Voraussetzungen pruefen ------------------------------------------- step "Voraussetzungen pruefen" -for cmd in nix-build nix-env curl sha256sum; do +for cmd in nix-build nix curl sha256sum; do command -v "$cmd" >/dev/null || err "$cmd nicht installiert. Abbruch." done ok "Nix, curl, sha256sum vorhanden" +# Profil-Typ erkennen: neues 'nix profile' (Default auf aktuellem NixOS mit +# flakes) oder altes 'nix-env'. Das Profil kann nur mit einem von beiden +# verwaltet werden — Mischbetrieb schlaegt fehl. +if nix profile list >/dev/null 2>&1; then + PROFILE_MODE="profile" +elif command -v nix-env >/dev/null 2>&1; then + PROFILE_MODE="env" +else + err "Weder 'nix profile' noch 'nix-env' verfuegbar. Abbruch." +fi + # jq ist auf Vanilla-NixOS nicht gesetzt — aus nixpkgs ziehen if ! command -v jq >/dev/null; then echo " ${YEL}!${RST} jq fehlt — hole aus nixpkgs" @@ -175,9 +186,18 @@ popd >/dev/null ok "Paket gebaut: $RESULT" # --- 6. Ins User-Profil installieren -------------------------------------- -step "Ins User-Profil installieren (nix-env)" -nix-env --uninstall claude-desktop 2>/dev/null || true -nix-env -i "$RESULT" +if [ "$PROFILE_MODE" = "profile" ]; then + step "Ins User-Profil installieren (nix profile)" + # Bestehende Installation entfernen (falls vorhanden) — Name ODER Index + nix profile remove claude-desktop 2>/dev/null \ + || nix profile remove '.*claude-desktop.*' 2>/dev/null \ + || true + nix profile install "$RESULT" +else + step "Ins User-Profil installieren (nix-env)" + nix-env --uninstall claude-desktop 2>/dev/null || true + nix-env -i "$RESULT" +fi ok "claude-desktop im \$PATH verfuegbar" # --- 7. Desktop-Datenbank refreshen ---------------------------------------