diff options
| author | tv <tv@krebsco.de> | 2026-11-21 02:26:12 +0000 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-21 04:08:15 +0100 |
| commit | a06a5d00a7f938fa44cf611bd2509104727960e9 (patch) | |
| tree | b5697ad3c69dcd8bad441fcccfd4d4a6bc54e591 /configs | |
| parent | e8fea350994cea2c9e88e913bf44d9fb5ec3b793 (diff) | |
configs: share claude-code, for layers on top of each other
claude and hermes each had their own claude-code and unfree predicate.
On top of each other, the predicates don't add up, one replaces the
other, and the claudes could drift apart with the next bump. Now both
import modules/claude-code.nix, which the module system takes only once:
claude-code, as pkgs.claude-code (an overlay), and its unfree predicate.
The package stays the same store path.
Diffstat (limited to 'configs')
| -rw-r--r-- | configs/claude.nix | 22 | ||||
| -rw-r--r-- | configs/hermes.nix | 24 |
2 files changed, 8 insertions, 38 deletions
diff --git a/configs/claude.nix b/configs/claude.nix index 8f02532..9d12210 100644 --- a/configs/claude.nix +++ b/configs/claude.nix @@ -9,29 +9,13 @@ let tmux = "${pkgs.tmux}/bin/tmux -S /run/claude/tmux"; - # nixos-26.05 has 2.1.223; Opus 5.5 needs 2.1.280. From npm's platform - # package, which has the plain binary and an integrity hash; - # x86_64-linux only, like the package. - claude-code = pkgs.claude-code.overrideAttrs (_: rec { - version = "2.1.329"; - src = pkgs.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 - ''; - }); - # Root's way into claude's tmux. claude-attach = pkgs.writeShellScriptBin "claude-attach" '' exec ${tmux} attach -t claude ''; in { - nixpkgs.config.allowUnfreePredicate = pkg: lib.getName pkg == "claude-code"; + imports = [ ../modules/claude-code.nix ]; fc.home.required = true; @@ -65,7 +49,7 @@ in # tmpfs: fail rather than keep the state there. unitConfig.AssertPathIsMountPoint = "/home"; path = [ - claude-code + pkgs.claude-code config.nix.package pkgs.bash pkgs.coreutils @@ -91,7 +75,7 @@ in User = "claude"; WorkingDirectory = "/home/claude/src"; RuntimeDirectory = "claude"; - ExecStart = "${tmux} new-session -d -s claude ${lib.getExe claude-code} remote-control"; + ExecStart = "${tmux} new-session -d -s claude ${lib.getExe pkgs.claude-code} remote-control"; Restart = "always"; RestartSec = 10; }; diff --git a/configs/hermes.nix b/configs/hermes.nix index 36fb9b3..902c280 100644 --- a/configs/hermes.nix +++ b/configs/hermes.nix @@ -20,22 +20,6 @@ let }}/claude-subscription-directsdk $out ''; - # The plugin's Claude models need claude 2.1.280 or newer; nixos-26.05 - # has 2.1.223. From npm's platform package, which has the plain binary - # and an integrity hash; x86_64-linux only, like the package. - claude-code = pkgs.claude-code.overrideAttrs (_: rec { - version = "2.1.329"; - src = pkgs.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 - ''; - }); - # The home drive, for hermes' services, see there. homeMount = { RequiresMountsFor = config.services.hermes-agent.stateDir; @@ -112,7 +96,10 @@ in { # Straight from the file, as the flake's nixosModules.default needs pkgs, # which imports can't use. - imports = [ (import (src + "/nix/nixosModules.nix") { inputs.self = hermes-agent; }).flake.nixosModules.default ]; + imports = [ + (import (src + "/nix/nixosModules.nix") { inputs.self = hermes-agent; }).flake.nixosModules.default + ../modules/claude-code.nix + ]; services.hermes-agent = { enable = true; @@ -148,14 +135,13 @@ in }; environmentFiles = [ "/xchg/hermes.env" ]; # The login is in ~/.claude, i.e. in stateDir. - extraPackages = [ claude-code ]; + extraPackages = [ pkgs.claude-code ]; }; # hermes for hermes' shells, too, like in a new window of the tmux. users.users.hermes.packages = [ config.services.hermes-agent.package pkgs.gitMinimal ]; - nixpkgs.config.allowUnfreePredicate = pkg: lib.getName pkg == "claude-code"; fc.home.required = true; # A normal user, with a home like any other. /home is mounted after |
