dot
vizie's NixOS desktop: Hyprland, CachyOS kernel and gaming tweaks
| 1 | # Anthropic's official Claude Desktop for Linux (beta), repackaged from the .deb in |
| 2 | # Anthropic's own apt repository: https://code.claude.com/docs/en/desktop-linux |
| 3 | # |
| 4 | # To update: pick the newest Filename/SHA256 pair from |
| 5 | # https://downloads.claude.ai/claude-desktop/apt/stable/dists/stable/main/binary-amd64/Packages |
| 6 | # and change version and sha256 below (the index's SHA256 is in hex, as here). |
| 7 | # |
| 8 | # Cowork also needs QEMU/KVM, the vhost_vsock module and OVMF firmware at the |
| 9 | # Debian path it looks for; modules/nixos/apps.nix provides those. |
| 10 | { |
| 11 | lib, |
| 12 | stdenv, |
| 13 | fetchurl, |
| 14 | dpkg, |
| 15 | autoPatchelfHook, |
| 16 | makeWrapper, |
| 17 | wrapGAppsHook3, |
| 18 | alsa-lib, |
| 19 | at-spi2-atk, |
| 20 | at-spi2-core, |
| 21 | cairo, |
| 22 | cups, |
| 23 | dbus, |
| 24 | expat, |
| 25 | glib, |
| 26 | gtk3, |
| 27 | libdrm, |
| 28 | libgbm, |
| 29 | libglvnd, |
| 30 | libnotify, |
| 31 | libpulseaudio, |
| 32 | libsecret, |
| 33 | libuuid, |
| 34 | libxkbcommon, |
| 35 | libayatana-appindicator, |
| 36 | nspr, |
| 37 | nss, |
| 38 | pango, |
| 39 | pipewire, |
| 40 | systemd, |
| 41 | vulkan-loader, |
| 42 | libx11, |
| 43 | libxcomposite, |
| 44 | libxdamage, |
| 45 | libxext, |
| 46 | libxfixes, |
| 47 | libxrandr, |
| 48 | libxtst, |
| 49 | libxshmfence, |
| 50 | libxcb, |
| 51 | libseccomp, |
| 52 | libcap_ng, |
| 53 | xdg-utils, |
| 54 | qemu_kvm, |
| 55 | socat, |
| 56 | bubblewrap, |
| 57 | openssh, |
| 58 | }: |
| 59 | |
| 60 | stdenv.mkDerivation (finalAttrs: { |
| 61 | pname = "claude-desktop"; |
| 62 | version = "2.42304.0"; |
| 63 | |
| 64 | src = fetchurl { |
| 65 | url = "https://downloads.claude.ai/claude-desktop/apt/stable/pool/main/c/claude-desktop/claude-desktop__amd64.deb"; |
| 66 | sha256 = "74cd2ccc29d24165144e455cbc872c6cc2a24a263b83e73420e95f89166d4aa4"; |
| 67 | }; |
| 68 | |
| 69 | nativeBuildInputs = [ |
| 70 | dpkg |
| 71 | autoPatchelfHook |
| 72 | makeWrapper |
| 73 | wrapGAppsHook3 |
| 74 | ]; |
| 75 | |
| 76 | buildInputs = [ |
| 77 | alsa-lib |
| 78 | at-spi2-atk |
| 79 | at-spi2-core |
| 80 | cairo |
| 81 | cups |
| 82 | dbus |
| 83 | expat |
| 84 | glib |
| 85 | gtk3 |
| 86 | libdrm |
| 87 | libgbm |
| 88 | libnotify |
| 89 | libpulseaudio |
| 90 | libsecret |
| 91 | libuuid |
| 92 | libxkbcommon |
| 93 | nspr |
| 94 | nss |
| 95 | pango |
| 96 | pipewire |
| 97 | systemd |
| 98 | libx11 |
| 99 | libxcomposite |
| 100 | libxdamage |
| 101 | libxext |
| 102 | libxfixes |
| 103 | libxrandr |
| 104 | libxtst |
| 105 | libxshmfence |
| 106 | libxcb |
| 107 | # The bundled virtiofsd (Cowork). |
| 108 | libseccomp |
| 109 | libcap_ng |
| 110 | ]; |
| 111 | |
| 112 | # Loaded with dlopen at run time, so autoPatchelf can't see them. |
| 113 | runtimeLibs = [ |
| 114 | libglvnd |
| 115 | libnotify |
| 116 | libpulseaudio |
| 117 | libayatana-appindicator |
| 118 | pipewire |
| 119 | systemd |
| 120 | vulkan-loader |
| 121 | ]; |
| 122 | |
| 123 | dontWrapGApps = true; |
| 124 | |
| 125 | unpackPhase = '' |
| 126 | runHook preUnpack |
| 127 | # Not dpkg-deb -x: the sandbox can't recreate chrome-sandbox's setuid bit. |
| 128 | dpkg-deb --fsys-tarfile $src | tar -x --no-same-permissions --no-same-owner |
| 129 | runHook postUnpack |
| 130 | ''; |
| 131 | |
| 132 | installPhase = '' |
| 133 | runHook preInstall |
| 134 | |
| 135 | mkdir -p $out/lib $out/bin |
| 136 | cp -r usr/lib/claude-desktop $out/lib/ |
| 137 | cp -r usr/share $out/ |
| 138 | rm -rf $out/share/lintian |
| 139 | |
| 140 | # The setuid sandbox helper can't be setuid in the Nix store; Chromium uses |
| 141 | # the user-namespace sandbox instead, which needs no helper. |
| 142 | rm $out/lib/claude-desktop/chrome-sandbox |
| 143 | |
| 144 | runHook postInstall |
| 145 | ''; |
| 146 | |
| 147 | postFixup = '' |
| 148 | makeWrapper $out/lib/claude-desktop/claude-desktop $out/bin/claude-desktop \ |
| 149 | "''${gappsWrapperArgs[@]}" \ |
| 150 | --prefix LD_LIBRARY_PATH : \ |
| 151 | --prefix PATH : |
| 152 | |
| 153 | |
| 154 | |
| 155 | |
| 156 | |
| 157 | |
| 158 | |
| 159 | |
| 160 | ''; |
| 161 | |
| 162 | meta = { |
| 163 | description = "Claude desktop app (official Linux beta build)"; |
| 164 | homepage = "https://claude.ai/download"; |
| 165 | license = lib.licenses.unfree; |
| 166 | mainProgram = "claude-desktop"; |
| 167 | platforms = [ "x86_64-linux" ]; |
| 168 | sourceProvenance = [ lib.sourceTypes.binaryNativeCode ]; |
| 169 | }; |
| 170 | }) |