Skip to content

Comments

fix: set force=true on config home.file to prevent clobber errors#51

Open
ioitiki wants to merge 3 commits intoopenclaw:mainfrom
ioitiki:fix/config-file-force-nix-mode
Open

fix: set force=true on config home.file to prevent clobber errors#51
ioitiki wants to merge 3 commits intoopenclaw:mainfrom
ioitiki:fix/config-file-force-nix-mode

Conversation

@ioitiki
Copy link

@ioitiki ioitiki commented Feb 8, 2026

Summary

  • Set force = true on the home.file entry for openclaw.json so home-manager overwrites it unconditionally
  • Fixes home-manager switch failing with "Existing file would be clobbered" after the gateway replaces the nix store symlink with a regular file

Root cause

The gateway's applyPluginAutoEnable runs on startup and calls writeConfigFile() even when OPENCLAW_NIX_MODE=1 is set. This replaces the read-only nix store symlink with a regular file. On the next home-manager switch, the checkLinkTargets step fails because it refuses to overwrite an unmanaged regular file.

The isNixMode guard exists for legacy config migration but is missing from the plugin auto-enable code path. This PR works around that by telling home-manager it's safe to overwrite.

Test plan

  • Verified existing checks (openclaw-config-validity, openclaw-hm-activation) are unaffected — they access .text, not force
  • Run home-manager switch after gateway has replaced the symlink — should succeed without -b backup

Fixes #50

🤖 Generated with Claude Code

The gateway's plugin auto-enable writes to openclaw.json on startup,
replacing the nix store symlink with a regular file. This causes
subsequent `home-manager switch` to fail with "would be clobbered".

Setting force=true on the home.file entry allows home-manager to
overwrite the file unconditionally, which is safe since the config
is declaratively managed and the gateway only reads it at runtime.

Fixes openclaw#50

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@ioitiki
Copy link
Author

ioitiki commented Feb 8, 2026

_The config-validity check failure is pre-existing and also reproduces on main:

$ nix build .#checks.x86_64-linux.config-validity
> Missing validation module: /nix/store/jy7rkkw8hb637z461fg9ibw16swfs2n4-openclaw-gateway-2026.1.8-2/lib/openclaw/dist/config/validation.js

The check script's fallback scan of dist/config-*.js files is not finding a validateConfigObject export in the current gateway package. Unrelated to this PR's change._

update:
this is fixed

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.

Plugin auto-enable writes to config file in Nix mode

1 participant