Skip to content

build(pnpm): unpack packages into the shared virtual store - #204

Merged
furedea merged 1 commit into
mainfrom
build/pnpm-shared-virtual-store
Oct 17, 2026
Merged

furedea merged 1 commit into
mainfrom
build/pnpm-shared-virtual-store

Conversation

@furedea-agent

@furedea-agent furedea-agent Bot commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

The sandbox always denies writing .idea and .vscode inside the working directory, and no setting exempts node_modules. anthropics/claude-code#33054 and #80077 were closed as not planned. Packages such as iconv-lite 0.6.3 ship an .idea directory, so pnpm install failed in every fresh worktree.

  • ~/.config/pnpm/rc (home-manager): store-dir=$XDG_DATA_HOME/pnpm/store and enable-global-virtual-store=true. pnpm unpacks packages under the store's links, outside the project, and node_modules holds only links.
  • Sandbox: ~/.local/share/pnpm is writable. Nothing new runs outside the sandbox.
  • Side effect: repeat installs across projects and worktrees link already-unpacked packages, so they are near-instant.

Closes #203

Verification

  • Probe project with only iconv-lite 0.6.3, inside this repository, in the sandbox:
    • the default install failed with EPERM on .idea/codeStyles;
    • with the virtual store outside the project it succeeded, and require('iconv-lite') worked;
    • with enable-global-virtual-store it also succeeded and loaded.
  • nix build .#checks.aarch64-darwin.home-configuration passed. It includes a new pnpm-shared-virtual-store check, and the rendered rc has the two settings.
  • tests/agents/claude/test_settings.py passed.

🤖 Generated with Claude Code

The sandbox always denies writing .idea and .vscode inside the working
directory, and packages such as iconv-lite 0.6.3 ship them, so pnpm
install failed in fresh worktrees. pnpm now uses its global virtual
store under the XDG data home, which the sandbox may write, and
node_modules holds only links; repeat installs also become near-instant.

Closes #203

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@furedea
furedea merged commit e471b2f into main Oct 17, 2026
11 checks passed
@furedea
furedea deleted the build/pnpm-shared-virtual-store branch October 17, 2026 14:14
furedea added a commit that referenced this pull request Oct 18, 2026
…yaml (#223)

`pnpm install` in the furedea.com lane for #221 failed with
`ERR_PNPM_EPERM` on `mkdir
…/node_modules/.pnpm/[email protected]/…/.idea/codeStyles`.

pnpm 11 reads only auth and registry settings from rc files, so
`store-dir` and `enable-global-virtual-store` in `~/.config/pnpm/rc`
(#204) were silently ignored: `pnpm config get
enable-global-virtual-store` and `store-dir` both print `undefined` on
pnpm 11.27.0. Packages then unpacked into the project's `node_modules`
again, where the agent sandbox denies the `.idea` directories some
packages ship. pnpm 11 reads its own settings from
`$XDG_CONFIG_HOME/pnpm/config.yaml`.

## Changes

- `nix/home/default.nix`: replace `pnpm/rc` with `pnpm/config.yaml`
holding `storeDir` and `enableGlobalVirtualStore: true`.
- `nix/checks.nix`: `pnpm-shared-virtual-store` now checks the YAML
file.

## Verification

- `pnpm-shared-virtual-store` was updated first and failed (`attribute
"pnpm/config.yaml" missing`).
- With a scratch `XDG_CONFIG_HOME` holding the same YAML, pnpm 11.27.0
resolves `enableGlobalVirtualStore` to `true` and `storeDir` to
`~/.local/share/pnpm/store`.
- `nix build .#checks.aarch64-darwin.home-configuration
.#checks.aarch64-darwin.host-configuration
.#darwinConfigurations.mbp.system`: pass.

After merge, `darwin-rebuild switch` installs the file.

Refs #221

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: furedea <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

サンドボックス内で pnpm install が通るよう共有仮想ストアを使う

1 participant