summaryrefslogtreecommitdiffstats
path: root/configs/claude.nix
diff options
context:
space:
mode:
Diffstat (limited to 'configs/claude.nix')
-rw-r--r--configs/claude.nix31
1 files changed, 13 insertions, 18 deletions
diff --git a/configs/claude.nix b/configs/claude.nix
index e4fde84..05583a9 100644
--- a/configs/claude.nix
+++ b/configs/claude.nix
@@ -3,31 +3,26 @@
# One per remote, claude-remote-control@NAME, main by default; more by
# adding them in a layer:
# systemd.targets.multi-user.wants = [ "claude-remote-control@NAME.service" ];
-# or with systemctl start claude-remote-control@NAME, which lasts, across
-# reboots, until systemctl stop (see stateDir).
+# or with claude-remote start NAME (root's tool for the remotes, see
+# pkgs/claude-remote.nix), which lasts, across reboots, until
+# claude-remote stop NAME (see stateDir).
# A remote is a context: it works in ~/remotes/NAME, which is its project
# for Claude Code (sessions, memory, trust), on the repositories in ~/src,
# which all remotes share. Each runs as claude in a tmux of its own,
-# which root opens with claude-attach [NAME]. Once, as root: runuser -l
-# claude -c 'claude auth login', then, for each NAME, claude-attach NAME
-# and answer Remote Control's questions there (enable it, trust
-# ~/remotes/NAME). The state is in /home/claude, i.e. on the run
-# script's --home drive, which is required.
+# which root opens with claude-remote attach [NAME]. Once, as root:
+# runuser -l claude -c 'claude auth login', then, for each NAME,
+# claude-remote attach NAME and answer Remote Control's questions there
+# (enable it, trust ~/remotes/NAME). The state is in /home/claude, i.e.
+# on the run script's --home drive, which is required.
{ config, lib, pkgs, ... }:
let
# The tmux of claude-remote-control@NAME.
tmux = name: "${pkgs.tmux}/bin/tmux -S /run/claude/${name}/tmux";
- # Root's way into claude's tmuxes.
- claude-attach = pkgs.writeShellScriptBin "claude-attach" ''
- # usage: claude-attach [NAME] (default: main)
- name=''${1:-main}
- if ! test -S /run/claude/"$name"/tmux; then
- echo "claude-attach: no claude-remote-control@$name running" >&2
- exit 1
- fi
- exec ${tmux "\"$name\""} attach -t claude
- '';
+ # Root's tool for the remotes.
+ claude-remote = pkgs.callPackage ../pkgs/claude-remote.nix {
+ inherit stateDir;
+ };
# Remotes started with systemctl, rather than by multi-user.target's
# wants (static), come back after a reboot: each has a file of its name
@@ -176,5 +171,5 @@ in
done
'';
};
- environment.systemPackages = [ claude-attach ];
+ environment.systemPackages = [ claude-remote ];
}