Files
homelab/pkgs/claude-desktop.nix
T
2026-09-25 00:52:03 +02:00

140 lines
2.8 KiB
Nix

{ lib
, stdenv
, fetchurl
, dpkg
, autoPatchelfHook
, makeWrapper
, wrapGAppsHook3
, alsa-lib
, at-spi2-atk
, at-spi2-core
, atk
, cairo
, cups
, dbus
, expat
, glib
, gtk3
, libcap_ng
, libdrm
, libgbm
, libseccomp
, libxkbcommon
, nspr
, nss
, pango
, systemd
, libx11
, libxcb
, libxcomposite
, libxdamage
, libxext
, libxfixes
, libxrandr
, libxtst
, libGL
, libayatana-appindicator
, libnotify
, libpulseaudio
, libsecret
, pipewire
, wayland
, qemu_kvm
, xdg-utils
}:
# Anthropic's official Linux build (Debian .deb), patchelf'd in place. The
# bundled Electron binary is kept rather than swapped for nixpkgs' electron:
# app.asar ships a V8 code cache (compile-cache/*.jsc) tied to that exact build.
#
# Cowork looks for qemu on $PATH but for OVMF and virtiofsd only at fixed
# Debian paths; services/desktop/claude-desktop.nix symlinks those into /usr.
#
# Bump: take the highest `Version:` listed in
# https://downloads.claude.ai/claude-desktop/apt/stable/dists/stable/main/binary-amd64/Packages
stdenv.mkDerivation (finalAttrs: {
pname = "claude-desktop";
version = "2.7032.0";
src = fetchurl {
url = "https://downloads.claude.ai/claude-desktop/apt/stable/pool/main/c/claude-desktop/claude-desktop_${finalAttrs.version}_amd64.deb";
hash = "sha256-Hn9FBLylsvay08QSPRRdcnZH538u4tBGhQcR5h59exE=";
};
nativeBuildInputs = [ dpkg autoPatchelfHook makeWrapper wrapGAppsHook3 ];
buildInputs = [
alsa-lib
at-spi2-atk
at-spi2-core
atk
cairo
cups
dbus
expat
glib
gtk3
libcap_ng # bundled virtiofsd
libdrm
libgbm
libseccomp # bundled virtiofsd
libxkbcommon
nspr
nss
pango
stdenv.cc.cc.lib # node-pty
systemd
libx11
libxcb
libxcomposite
libxdamage
libxext
libxfixes
libxrandr
libxtst
];
# dlopen'd by Chromium, so not in any DT_NEEDED.
runtimeDependencies = [
libGL
libayatana-appindicator
libnotify
libpulseaudio
libsecret
pipewire
systemd
wayland
];
dontWrapGApps = true;
installPhase = ''
runHook preInstall
mkdir -p $out/lib $out/bin
cp -r usr/lib/claude-desktop $out/lib/
cp -r usr/share $out/share
rm -r $out/share/lintian
# Setuid is impossible in the store; Chromium falls back to its userns sandbox.
rm $out/lib/claude-desktop/chrome-sandbox
runHook postInstall
'';
postFixup = ''
makeWrapper $out/lib/claude-desktop/claude-desktop $out/bin/claude-desktop \
"''${gappsWrapperArgs[@]}" \
--prefix PATH : ${lib.makeBinPath [ qemu_kvm xdg-utils ]}
'';
meta = {
description = "Desktop application for Claude.ai";
homepage = "https://claude.ai";
license = lib.licenses.unfree;
sourceProvenance = [ lib.sourceTypes.binaryNativeCode ];
platforms = [ "x86_64-linux" ];
mainProgram = "claude-desktop";
};
})