THIS IS AN UNOFFICIAL BUILD SCRIPT!
If you run into an issue with this build script, make an issue here. Don't bug Anthropic about it - they already have enough on their plates.
Supports the Ctrl+Alt+Space popup!
Supports the Tray menu! (Screenshot of running on KDE)
This is a Nix flake for running Claude Desktop on Linux.
To run this once, make sure Nix is installed, then run
NIXPKGS_ALLOW_UNFREE=1 nix run github:k3d3/claude-desktop-linux-flake --impure
The "unfree" part is due to the fact that Claude Desktop is not an open source application, and thus, Nix's licensing rules are dictated by the application itself, not the build script used to build the application.
Add the following to your flake.nix
:
inputs.claude-desktop.url = "github:k3d3/claude-desktop-linux-flake";
inputs.claude-desktop.inputs.nixpkgs.follows = "nixpkgs";
inputs.claude-desktop.inputs.flake-utils.follows = "flake-utils";
And then the following package to your environment.systemPackages
or home.packages
:
inputs.claude-desktop.packages.${system}.claude-desktop
This repository only provides a Nix flake, and does not provide a package for e.g. Ubuntu, Fedora, or Arch Linux.
Other known variants:
- https://github.com/wankdanker/claude-desktop-linux-bash - A bash-based Claude Desktop builder that works on Ubuntu and possibly other Debian derivatives
If anyone else packages Claude Desktop for other distributions, make an issue or PR and I'll link it here.
Claude Desktop is an Electron application. That means the majority of the application is inside an app.asar
archive, which usually contains minified Javascript, HTML, and CSS, along with images and a few other things.
Despite there being no official Linux Claude Desktop release, the vast majority of the code is completely cross-platform.
With the exception of one library.
Node, and by extension Electron, allow you to import natively-compiled objects into the Node runtime as if they were regular modules. These are typically used to extend the functionality in ways Node itself can't do. Only problem, as shown above, is that these objects are only compiled for one OS.
Luckily enough, because it's a loadable Node module, that means you can open it up yourself in node and inspect it - no decompilation or disassembly needed:
There are many functions here for getting monitor/window information, as well as for controlling the mouse and keyboard. I'm not sure what exactly these are for - my best guess is something unreleased related to Computer Use, however I'm not a huge fan of this functionality existing in the first place.
As for how to move forward with getting Claude Desktop working on Linux, seeing as how the API surface area of this module is relatively small, it looked fairly easy to just wholesale reimplement it, using stubs for the functionality.
The result of that is a library I call patchy-cnb
, which uses NAPI-RS to match the original API with stub functions.
Turns out, the original module also used NAPI-RS. Neat!
From there, it's just a matter of compiling patchy-cnb
, repackaging the app.asar to include the newly built Linux module, and
making a new Electron build with these files.
The build scripts in this repository, as well as patchy-cnb
, are dual-licensed under the terms of the MIT license and the Apache License (Version 2.0).
See LICENSE-MIT and LICENSE-APACHE for details.
The Claude Desktop application, not included in this repository, is likely covered by Anthropic's Consumer Terms.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.