summaryrefslogtreecommitdiff
path: root/hostnix/mojo/packages/claude-code/default.nix
blob: a9798fdf81f0ee041d84e1a2e19cc52a496f330f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
{ writeShellScriptBin, claude-code }:

writeShellScriptBin "claude" ''
  if [[ $HOME/ = ''${PWD%/}/* ]]; then
    echo "fatal: refusing to allow access to $PWD" >&2
    exit 1
  fi

  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" \
    ${claude-code}/bin/claude \
    --allow-dangerously-skip-permissions "$@"
''