diff options
Diffstat (limited to 'hostnix/mojo')
| -rw-r--r-- | hostnix/mojo/packages/claude-code/claude.sb | 10 | ||||
| -rw-r--r-- | hostnix/mojo/packages/claude-code/default.nix | 5 |
2 files changed, 15 insertions, 0 deletions
diff --git a/hostnix/mojo/packages/claude-code/claude.sb b/hostnix/mojo/packages/claude-code/claude.sb index 1117b18..3adb074 100644 --- a/hostnix/mojo/packages/claude-code/claude.sb +++ b/hostnix/mojo/packages/claude-code/claude.sb @@ -114,6 +114,10 @@ ;; Project directory - primary workspace (subpath (param "TARGET_DIR")) + ;; Include .git and .jj directories in case the root is above TARGET_DIR. + (subpath (param "GIT_DIR")) + (subpath (param "JJ_DIR")) + ;; Temporary directories (subpath (param "TMP_DIR")) (subpath "/tmp") @@ -287,6 +291,12 @@ (subpath "/Library/Java") ) +;; Xcode Command Line Tools - needed so /usr/bin/git (an xcode-select shim) +;; can locate the real git binary +(allow file-read* + (subpath "/Library/Developer/CommandLineTools") +) + ;; Generated allow-read rules for: /Users/joe/src ;; for some reason claude-code needs list access to all parent directories of TARGET_DIR ;; - it doesn't need access to read the contents of directories, only the directories diff --git a/hostnix/mojo/packages/claude-code/default.nix b/hostnix/mojo/packages/claude-code/default.nix index a9798fd..2e3fd35 100644 --- a/hostnix/mojo/packages/claude-code/default.nix +++ b/hostnix/mojo/packages/claude-code/default.nix @@ -6,11 +6,16 @@ writeShellScriptBin "claude" '' exit 1 fi + git_dir="$(git rev-parse --absolute-git-dir 2>/dev/null)" + jj_root="$(jj root --ignore-working-copy 2>/dev/null)" + exec /usr/bin/sandbox-exec -f ${./claude.sb} \ -D TARGET_DIR="$(realpath "$PWD")" \ -D TMP_DIR=/tmp \ -D HOME_DIR="$HOME" \ -D CACHE_DIR="$HOME/.cache" \ + -D GIT_DIR="''${git_dir:-$PWD/.git}" \ + -D JJ_DIR="''${jj_root:-$PWD}/.jj" \ ${claude-code}/bin/claude \ --allow-dangerously-skip-permissions "$@" '' |
