claude-desktop/nix/default.nix
Eddy 506f1d3fdc
All checks were successful
Build AppImage / build (push) Successful in 7m52s
[appimage] Auto-Updater: Package Registry + update.json + Nix-Wrapper
- update.rs: Umstellung auf Package-Registry-Manifest mit SHA256-Verify,
  Basic-Auth, dev/APPIMAGE/Nix-Wrapper-Modus. Liest binary_filename
  im Nix-Modus (AppImage laeuft auf NixOS nicht)
- Nix-Wrapper-Paket (nix/default.nix): LD_LIBRARY_PATH-korrekter Launcher
  + Installer-Script, User-Home-Binary (writable fuer Auto-Update)
- CI laedt jetzt AppImage UND natives Binary + update.json v2
  (binary_filename/binary_sha256) in die Package Registry
- Svelte: Store-basierter Update-Trigger, manueller Check im
  Settings-Panel, "Kein Update"-Dialog-Variante, expectedSha256-Param
- install.sh: One-Click-Installer fuer NixOS (curl | bash)
- sha2-Dep fuer Integritaets-Check des Downloads

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-20 11:05:19 +02:00

129 lines
4 KiB
Nix
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Claude Desktop — Nix-Wrapper-Paket
#
# Liefert:
# $out/bin/claude-desktop — Launcher mit LD_LIBRARY_PATH
# $out/bin/claude-desktop-install — Installer (kopiert Binary nach ~/.local/share)
# $out/share/applications/… — Desktop-Entry
# $out/share/icons/… — Icon
#
# Das eigentliche Binary lebt unter ~/.local/share/claude-desktop/bin/claude-desktop
# (writable), damit der Auto-Updater es ersetzen kann. Nix-Store ist read-only und
# waere deshalb inkompatibel mit dem Rename-Trick in apply_update().
#
# Einbinden in /etc/nixos/configuration.nix:
#
# environment.systemPackages = [
# (import /pfad/zum/claude-desktop/nix/default.nix { inherit pkgs; })
# ];
#
# Oder per home-manager:
# home.packages = [ (import ./claude-desktop/nix/default.nix { inherit pkgs; }) ];
{ pkgs ? import <nixpkgs> {} }:
let
# Alle Laufzeit-Libs, die das Tauri-Binary braucht (parallel zu shell.nix).
runtimeLibs = with pkgs; [
webkitgtk_4_1
libappindicator-gtk3
librsvg
gtk3
glib
cairo
pango
gdk-pixbuf
libsoup_3
at-spi2-atk
openssl
];
in
pkgs.stdenv.mkDerivation {
pname = "claude-desktop";
version = "0.1.0";
# Keine Quelldateien — Wir packen nur Wrapper + Desktop-Entry
dontUnpack = true;
nativeBuildInputs = [ pkgs.makeWrapper ];
installPhase = ''
runHook preInstall
mkdir -p $out/bin $out/share/applications $out/share/icons/hicolor/256x256/apps
# 1) Launcher: startet das User-Binary mit Nix-LD_LIBRARY_PATH
cat > $out/bin/claude-desktop <<'LAUNCHER'
#!${pkgs.bash}/bin/bash
# Claude Desktop NixOS-Launcher
set -e
APP_DIR="$HOME/.local/share/claude-desktop"
BIN="$APP_DIR/bin/claude-desktop"
if [ ! -x "$BIN" ]; then
echo " Claude-Desktop-Binary nicht gefunden: $BIN" >&2
echo "" >&2
echo "Erst installieren (aus fertigem Build in /tmp/claude-target):" >&2
echo " claude-desktop-install" >&2
echo "" >&2
echo "Oder neu bauen im Repo:" >&2
echo " CARGO_TARGET_DIR=/tmp/claude-target \\" >&2
echo " nix-shell shell.nix --run 'npm ci && npm run tauri build'" >&2
echo " claude-desktop-install" >&2
exit 1
fi
# Marker fuer update.rs: wir laufen unter Nix-Wrapper
export CLAUDE_DESKTOP_NIX_WRAPPER=1
export CLAUDE_DESKTOP_BIN="$BIN"
exec "$BIN" "$@"
LAUNCHER
chmod +x $out/bin/claude-desktop
# LD_LIBRARY_PATH dauerhaft ans Launcher-Script binden
wrapProgram $out/bin/claude-desktop \
--prefix LD_LIBRARY_PATH : ${pkgs.lib.makeLibraryPath runtimeLibs}
# 2) Installer: kopiert ein frisch gebautes Binary an den Ziel-Ort
cat > $out/bin/claude-desktop-install <<'INSTALLER'
#!${pkgs.bash}/bin/bash
set -e
SRC="''${1:-/tmp/claude-target/release/claude-desktop}"
DEST_DIR="$HOME/.local/share/claude-desktop/bin"
DEST="$DEST_DIR/claude-desktop"
if [ ! -x "$SRC" ]; then
echo " Quelle nicht gefunden oder nicht ausfuehrbar: $SRC" >&2
echo "" >&2
echo "Erst bauen:" >&2
echo " cd <repo>; CARGO_TARGET_DIR=/tmp/claude-target \\" >&2
echo " nix-shell shell.nix --run 'npm ci && npm run tauri build'" >&2
exit 1
fi
mkdir -p "$DEST_DIR"
cp "$SRC" "$DEST"
chmod +x "$DEST"
echo " Claude Desktop installiert nach $DEST"
echo " Starten mit: claude-desktop (oder aus KDE-Menue)"
INSTALLER
chmod +x $out/bin/claude-desktop-install
# 3) Desktop-Entry
cp ${./claude-desktop.desktop} $out/share/applications/claude-desktop.desktop
# 4) Icon
cp ${../src-tauri/icons/icon.png} $out/share/icons/hicolor/256x256/apps/claude-desktop.png
runHook postInstall
'';
meta = with pkgs.lib; {
description = "Native Desktop-App fuer Claude Code (Wrapper-Paket, Binary in ~/.local/share)";
homepage = "https://git.data-it-solution.de/data/claude-desktop";
license = licenses.mit;
platforms = platforms.linux;
mainProgram = "claude-desktop";
};
}