Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 6 additions & 11 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions home-manager/modules/paperclip/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ lib.mkIf host.isKyber {
'';

# Systemd service for Paperclip
# Uses bun runtime instead of node to avoid pino-http crash (logger[stringifySym] is not a function)
systemd.user.services.paperclip = {
Unit = {
Description = "Paperclip AI agent orchestration platform";
Expand All @@ -27,13 +26,20 @@ lib.mkIf host.isKyber {
};
Service = {
Type = "simple";
ExecStart = "${homeDir}/.nix-profile/bin/bun run ${homeDir}/.bun/install/global/node_modules/paperclipai/dist/index.js run --no-repair";
ExecStart = "${homeDir}/dotfiles/node_modules/.bin/paperclipai run --no-repair";
Restart = "always";
RestartSec = "5s";
Environment = [
"HOME=${homeDir}"
"HOST=0.0.0.0"
"PAPERCLIP_DEPLOYMENT_MODE=authenticated"
"PAPERCLIP_ALLOWED_HOSTNAMES=paperclip.shunkakinoki.com,172.17.0.1"
"PATH=${homeDir}/.local/bin:${homeDir}/.bun/bin:${homeDir}/.nix-profile/bin:${homeDir}/.local/share/pnpm:${homeDir}/.local/share/fnm/current/bin:${homeDir}/.npm-global/bin:/usr/local/bin:/usr/bin:/bin"
];
EnvironmentFile = [
"${homeDir}/dotfiles/.env"
"${homeDir}/.paperclip/instances/default/.env"
Comment on lines +40 to +41

Copilot AI Apr 4, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EnvironmentFile entries are required by systemd; if either ${homeDir}/dotfiles/.env or ${homeDir}/.paperclip/instances/default/.env is missing, the unit will fail to start. Either ensure these files (and the instances/default directory) are created with appropriate permissions during activation, or prefix the paths with - to make them optional and handle missing values another way.

Suggested change
"${homeDir}/dotfiles/.env"
"${homeDir}/.paperclip/instances/default/.env"
"-${homeDir}/dotfiles/.env"
"-${homeDir}/.paperclip/instances/default/.env"

Copilot uses AI. Check for mistakes.
Comment on lines +40 to +41

@cubic-dev-ai cubic-dev-ai Bot Apr 4, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1: Systemd's EnvironmentFile directive treats unprefixed paths as required — the service will refuse to start if either file is missing (e.g. fresh machine, before manual setup). Prefix with - to make them optional:

EnvironmentFile = [
  "-${homeDir}/dotfiles/.env"
  "-${homeDir}/.paperclip/instances/default/.env"
];
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At home-manager/modules/paperclip/default.nix, line 44:

<comment>Systemd's `EnvironmentFile` directive treats unprefixed paths as required — the service will refuse to start if either file is missing (e.g. fresh machine, before manual setup). Prefix with `-` to make them optional:
```nix
EnvironmentFile = [
  "-${homeDir}/dotfiles/.env"
  "-${homeDir}/.paperclip/instances/default/.env"
];
```</comment>

<file context>
@@ -27,14 +30,21 @@ lib.mkIf host.isKyber {
       ];
-      WorkingDirectory = "${homeDir}/.paperclip";
+      EnvironmentFile = [
+        "${homeDir}/dotfiles/.env"
+        "${homeDir}/.paperclip/instances/default/.env"
+      ];
</file context>
Suggested change
"${homeDir}/dotfiles/.env"
"${homeDir}/.paperclip/instances/default/.env"
"-${homeDir}/dotfiles/.env"
"-${homeDir}/.paperclip/instances/default/.env"
Fix with Cubic

];
Comment on lines +39 to +42

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The EnvironmentFile directive in systemd will cause the service to fail to start if any of the specified files do not exist. Since these files (such as ~/dotfiles/.env or the instance-specific .env) might be missing on a fresh installation or before manual configuration, it is more robust to prefix the paths with -. This tells systemd to ignore the file if it is missing, allowing the service to attempt to start and let the application handle missing environment variables (consistent with the logic in hydrate.sh).

      EnvironmentFile = [
        "-${homeDir}/dotfiles/.env"
        "-${homeDir}/.paperclip/instances/default/.env"
      ];

Comment on lines +39 to +42

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

EnvironmentFile entries will cause service failure if files are missing.

Systemd's EnvironmentFile directive will fail service startup if the specified file doesn't exist. Consider prefixing with - to make them optional if that's acceptable, or ensure the files are created before service start.

       EnvironmentFile = [
-        "${homeDir}/dotfiles/.env"
-        "${homeDir}/.paperclip/instances/default/.env"
+        "-${homeDir}/dotfiles/.env"
+        "-${homeDir}/.paperclip/instances/default/.env"
       ];

Alternatively, if these files are strictly required, add assertions or activation scripts to validate their existence.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
EnvironmentFile = [
"${homeDir}/dotfiles/.env"
"${homeDir}/.paperclip/instances/default/.env"
];
EnvironmentFile = [
"-${homeDir}/dotfiles/.env"
"-${homeDir}/.paperclip/instances/default/.env"
];
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@home-manager/modules/paperclip/default.nix` around lines 43 - 46, The
EnvironmentFile entries under EnvironmentFile will cause service failure if the
files are missing; update the EnvironmentFile array to mark the entries optional
by prefixing each path with "-" (e.g. "-${homeDir}/dotfiles/.env") so systemd
won't fail when a file is absent, or alternatively add an assertion or an
activation script that creates/validates the files before the service starts;
locate the EnvironmentFile attribute in the Nix service declaration and apply
one of these fixes to ensure the service doesn't fail on missing files.

WorkingDirectory = "${homeDir}/.paperclip";
StandardOutput = "append:/tmp/paperclip/paperclip.log";
StandardError = "append:/tmp/paperclip/paperclip.log";
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,7 @@
"xcodebuildmcp": "^2.3.1"
},
"overrides": {
"pino": "9.6.0",
"pino-http": "9.0.0"
"pino": "9.14.0"
},
"trustedDependencies": [
"@anthropic-ai/claude-code",
Expand Down
Loading