dot
vizie's NixOS desktop: Hyprland, CachyOS kernel and gaming tweaks
| 1 | # Claude Code at the exact version Claude Desktop is built against: the app's |
| 2 | # Code tab runs it. Unpatched, the app downloads this same file at run time |
| 3 | # into ~/.config/Claude/claude-code, where NixOS can't run it; default.nix |
| 4 | # points the app here instead. |
| 5 | # |
| 6 | # To update (after changing the app's version): the app's pin is in its |
| 7 | # app.asar, in the JSON with "baseUrl":"https://downloads.claude.ai/claude-code-releases". |
| 8 | # Take "version" and platforms."linux-x64".checksum from it: |
| 9 | # asar extract .../resources/app.asar /tmp/app |
| 10 | # grep -o '{"version":"[0-9.]*","manifest".\{0,1500\}' /tmp/app/.vite/build/*.js |
| 11 | # The app's build fails with a message if the two versions disagree. |
| 12 | { |
| 13 | lib, |
| 14 | stdenv, |
| 15 | fetchurl, |
| 16 | zstd, |
| 17 | autoPatchelfHook, |
| 18 | }: |
| 19 | |
| 20 | stdenv.mkDerivation (finalAttrs: { |
| 21 | pname = "claude-code-for-desktop"; |
| 22 | version = "2.1.299"; |
| 23 | |
| 24 | src = fetchurl { |
| 25 | url = "https://downloads.claude.ai/claude-code-releases//linux-x64/claude.zst"; |
| 26 | sha256 = "20ca25213130255bacdcae3ed5df3fc99e1d8e86cdf46e9188b7ff9c1b478fa4"; |
| 27 | }; |
| 28 | |
| 29 | nativeBuildInputs = [ |
| 30 | zstd |
| 31 | autoPatchelfHook |
| 32 | ]; |
| 33 | |
| 34 | dontUnpack = true; |
| 35 | # The program's JavaScript is appended to the executable; strip would cut it. |
| 36 | dontStrip = true; |
| 37 | |
| 38 | installPhase = '' |
| 39 | runHook preInstall |
| 40 | install -d $out/bin |
| 41 | zstd -d $src -o $out/bin/claude |
| 42 | chmod 755 $out/bin/claude |
| 43 | runHook postInstall |
| 44 | ''; |
| 45 | |
| 46 | doInstallCheck = true; |
| 47 | installCheckPhase = '' |
| 48 | HOME=$TMPDIR $out/bin/claude --version | grep -F |
| 49 | ''; |
| 50 | |
| 51 | meta = { |
| 52 | description = "Claude Code, the version Claude Desktop's Code tab runs"; |
| 53 | homepage = "https://claude.com/claude-code"; |
| 54 | license = lib.licenses.unfree; |
| 55 | mainProgram = "claude"; |
| 56 | platforms = [ "x86_64-linux" ]; |
| 57 | sourceProvenance = [ lib.sourceTypes.binaryNativeCode ]; |
| 58 | }; |
| 59 | }) |