1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# Claude Code, as pkgs.claude-code, for the layers that use it. Each
# imports this, which the module system takes only once, so combined,
# they get the same claude, and one unfree predicate.
{ lib, ... }:
{
# nixos-26.05 has 2.1.223; Opus 5.5, and the Hermes plugin's Claude
# models, need 2.1.280. From npm's platform package, which has the
# plain binary and an integrity hash; x86_64-linux only, like the
# package.
nixpkgs.overlays = [
(_: prev: {
# alsa-lib (and its data, ~7M) is for voice input only, which it
# loads when asked to, and which is useless here: an empty one, for
# the wrapper's LD_LIBRARY_PATH (null would make that an empty
# entry, i.e. the current directory).
claude-code = (prev.claude-code.override {
alsa-lib = prev.runCommand "no-alsa-lib" { } "mkdir -p $out/lib";
}).overrideAttrs (_: rec {
version = "2.1.329";
src = prev.fetchurl {
url = "https://registry.npmjs.org/@anthropic-ai/claude-code-linux-x64/-/claude-code-linux-x64-${version}.tgz";
hash = "sha512-+n4lu1ubYAp02Y0X/MAUnxw9yY6SHHZ77F+IoW+V0wVoFuiI9opdH6gofjf14gXJCEYMTNpks7Gn1i8XZTKAWA==";
};
# installPhase installs $src as is.
preInstall = ''
tar -xzf $src package/claude
src=$PWD/package/claude
'';
});
})
];
nixpkgs.config.allowUnfreePredicate = pkg: lib.getName pkg == "claude-code";
}
|