fix: use nix-profile bun path for paperclip service - #1350
Conversation
|
You do not have enough credits to review this pull request. Please purchase more credits to continue. |
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 6 minutes and 51 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Mesa DescriptionTL;DR
What changed?File-level changes are not available in the provided summary. Description generated by Mesa. Update settings |
There was a problem hiding this comment.
Code Review
This pull request updates the ExecStart path for the paperclip service in the Home Manager module, switching from a local .bun directory to the .nix-profile path. Feedback suggests using the Nix package reference instead of a hardcoded profile path to ensure better reliability and proper dependency management.
| Service = { | ||
| Type = "simple"; | ||
| ExecStart = "${homeDir}/.bun/bin/bun run ${homeDir}/.bun/install/global/node_modules/paperclipai/dist/index.js run --no-repair"; | ||
| ExecStart = "${homeDir}/.nix-profile/bin/bun run ${homeDir}/.bun/install/global/node_modules/paperclipai/dist/index.js run --no-repair"; |
There was a problem hiding this comment.
Hardcoding the path to the bun binary in the user's profile (.nix-profile) is fragile and bypasses Nix's dependency tracking. A more robust and idiomatic approach in Home Manager is to use the bun package from pkgs directly (e.g., ${pkgs.bun}/bin/bun). This ensures that the binary is always available in the Nix store and correctly referenced by the service, regardless of the state of the user's profile. Note: To implement this, you will need to add pkgs to the module arguments at the top of the file (e.g., { config, lib, pkgs, inputs, ... }).
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Fixes the Paperclip user service crash loop by updating the ExecStart to point at the Bun binary location used by Nix profiles rather than the (non-existent) ~/.bun/bin/bun.
Changes:
- Update systemd service
ExecStartfrom~/.bun/bin/bunto~/.nix-profile/bin/bun.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| Service = { | ||
| Type = "simple"; | ||
| ExecStart = "${homeDir}/.bun/bin/bun run ${homeDir}/.bun/install/global/node_modules/paperclipai/dist/index.js run --no-repair"; | ||
| ExecStart = "${homeDir}/.nix-profile/bin/bun run ${homeDir}/.bun/install/global/node_modules/paperclipai/dist/index.js run --no-repair"; |
There was a problem hiding this comment.
Using ${homeDir}/.nix-profile/bin/bun hard-codes a user profile symlink path that may not exist (or may differ) depending on how Home Manager/Nix is installed (e.g., profile locations, flakes, or non-standard per-user profiles). For a more reproducible unit, prefer referencing Bun via a Nix store path (e.g., lib.getExe pkgs.bun) and ensure Bun is provided by the module (e.g., added to home.packages or otherwise made available), rather than relying on ~/.nix-profile.
* feat: add paperclip service (#1342) * feat: add paperclip service - Systemd service on kyber: runs `paperclipai run` via bun, depends on docker-postgres - Config via builtins.toJSON: external postgres on kyber, embedded on macOS - Setup script creates paperclip database on docker-postgres - Makefile target: `make systemctl-paperclip` * fix: add shellcheck disable and shell test coverage for paperclip * fix: correct shellcheck disable directive syntax * refactor: use config.template.json pattern for paperclip * refactor: rename setup.sh to hydrate.sh for paperclip * test: add auto-switch hook tests and update coverage spec * fix: remove EnvironmentFile from paperclip service (#1344) * fix: paperclip authenticated mode and required config fields (#1345) * fix: remove EnvironmentFile from paperclip service * fix: use authenticated mode on kyber, add required meta/logging fields * fix: add allowedHostnames for paperclip.shunkakinoki.com * fix: format config template json * fix: use trust auth for docker-postgres (#1346) POSTGRES_HOST_AUTH_METHOD=trust removes password auth for all connections. The password kept going out of sync after crash recovery, causing paperclip and other services to fail with 'password authentication failed'. Safe since postgres is only reachable from the host. * fix: use k8s postgres via DATABASE_URL, remove docker-postgres dep, add authenticated mode (#1347) * fix: use bun runtime for paperclip (pino-http node crash), k8s postgres via DATABASE_URL (#1348) * fix: use nix-profile bun path for paperclip service (#1350) * fix: add caret prefix to paperclipai dependency (#1349) * fix: use extra-substituters to avoid untrusted user warnings (#1351) * fix: run paperclip from cloned repo via pnpm dev:once (#1352) * fix: run paperclip from cloned repo via pnpm dev:once The global bun install flattens pino@10 + pino-http@10.5 together, but pino-http needs pino@9. The repo lockfile resolves this correctly with nested dependencies. Running from the repo avoids the crash. * fix: use bun run server/src/index.ts instead of pnpm dev:once * fix: pin pino@9.14.0 override, run paperclipai from dotfiles node_modules The bun flat hoisting was resolving pino@10 which is incompatible with pino-http@10.5. Pinning pino to 9.14.0 via overrides matches the paperclip repo's lockfile resolution and fixes the crash. * fix: use global bun paperclipai with pino override (#1353) * fix: use global ~/.bun/bin/paperclipai with pino override Propagate overrides from dotfiles package.json to ~/.bun/install/global/ so the global binary resolves pino@9.14.0 correctly. * test: add tests for npm-globals dependency overrides * fix: resolve GitHub Actions failures and code review issues - Fix non-portable \s regex to [[:space:]] in auto-switch.sh (shfmt compat) - Add jq dependency check alongside cswap - Use printf instead of echo for safer output - Fix claude-swap version from >=1.1.5 (non-existent) to >=0.7.1 - Add auto-switch.sh to Nix deployment config (default.nix) - Sort covered_scripts list alphabetically in coverage_spec.sh https://claude.ai/code/session_012GyQBesQGF1asTfKebWyLM --------- Co-authored-by: Claude <noreply@anthropic.com>
Summary
~/.bun/bin/bundoes not exist; bun is installed at~/.nix-profile/bin/bunSummary by cubic
Fix Paperclip service crash loop (systemd 203/EXEC) by using the
bunbinary from~/.nix-profile/bin/buninstead of~/.bun/bin/bun.Updates ExecStart in the home-manager module so the service starts reliably.
Written for commit 1d2dd43. Summary will update on new commits.