Skip to content

Comments

Add externalConfig option to support external openclaw.json files#59

Open
TorosFanny wants to merge 2 commits intoopenclaw:mainfrom
TorosFanny:main
Open

Add externalConfig option to support external openclaw.json files#59
TorosFanny wants to merge 2 commits intoopenclaw:mainfrom
TorosFanny:main

Conversation

@TorosFanny
Copy link

Summary

This PR adds a new externalConfig option to the nix-openclaw home-manager module, allowing users to specify an external openclaw.json file instead of generating config solely from Nix options.

Motivation

The nix-openclaw module generates openclaw.json from Nix code using schema-typed options. However, some channels (like Matrix) are not yet supported in the generated options. Users who need these unsupported channels must either:

  1. Manually maintain openclaw.json outside of home-manager (risk of being overwritten)
  2. Fork the module to add missing options

This PR provides a third option: use an external openclaw.json file directly while still benefiting from home-manager's declarative configuration.

Changes

  • Add externalConfig option in options-instance.nix:

    • Type: nullOr str
    • Accepts JSON content as a string (use builtins.readFile to read from file)
  • Update config.nix to:

    • Check if externalConfig is set
    • If set, use the external config directly
    • Add validation to prevent using both config and externalConfig simultaneously

Usage Example

programs.openclaw = {
  enable = true;
  instances.default = {
    # Use external config file
    externalConfig = builtins.toJSON (builtins.fromJSON (builtins.readFile ./openclaw.json));
  };
};

Backwards Compatibility

This change is fully backwards compatible. Existing configurations using config = { ... } will continue to work without any modifications.

QS added 2 commits February 19, 2026 11:51
- Add 'externalConfig' option in options-instance.nix for specifying external config
- Update config.nix to read external config file instead of generating from Nix options
- Supports both path and string types for flexibility

This allows users to use external openclaw.json files (e.g., with matrix config)
instead of being limited to the Nix-generated config options.
- Change externalConfig type to only accept string (not path)
- Add validation to prevent using both 'config' and 'externalConfig'
- Simplify config.nix logic by removing path handling
- Update option description to clarify mutual exclusivity
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.

1 participant