diff --git a/modules/programs/opencode.nix b/modules/programs/opencode.nix index 62a728653..92a28fd7e 100644 --- a/modules/programs/opencode.nix +++ b/modules/programs/opencode.nix @@ -39,6 +39,7 @@ in description = '' Configuration written to {file}`$XDG_CONFIG_HOME/opencode/config.json`. See for the documentation. + '"$schema": "https://opencode.ai/config.json"' is automatically added to the config. ''; }; rules = lib.mkOption { @@ -79,7 +80,12 @@ in xdg.configFile = { "opencode/config.json" = mkIf (cfg.settings != { }) { - source = jsonFormat.generate "config.json" cfg.settings; + source = jsonFormat.generate "config.json" ( + { + "$schema" = "https://opencode.ai/config.json"; + } + // cfg.settings + ); }; "opencode/AGENTS.md" = mkIf (cfg.rules != "") { text = cfg.rules; diff --git a/tests/modules/programs/opencode/config.json b/tests/modules/programs/opencode/config.json index 5e8f692ca..2ff8e5e1e 100644 --- a/tests/modules/programs/opencode/config.json +++ b/tests/modules/programs/opencode/config.json @@ -1,4 +1,5 @@ { + "$schema": "https://opencode.ai/config.json", "autoshare": false, "autoupdate": true, "model": "anthropic/claude-sonnet-4-20250514",