mirror of
https://github.com/nix-community/home-manager.git
synced 2026-12-06 04:40:17 +00:00
github-copilot-cli: write settings to settings.json
Since Copilot CLI 1.0.35, user settings live in settings.json and config.json holds internal state. On startup, 1.0.88 moves user keys out of a Home Manager config.json into settings.json and rewrites config.json as a regular file, replacing the link, so the next switch collides on config.json. Link the declared settings as settings.json instead and stop managing config.json, including the firstLaunchAt workaround that only existed for it. A read-only settings.json link survives startup; Copilot CLI replaces it only when it saves a setting. Copilot CLI drops trusted_folders from settings.json and moves trustedFolders into its own state in config.json, rewriting settings.json and so replacing a linked file. Leave both keys out of the file, warn when either is set, and do not manage the file when they are the only settings. Document the canonical allowedUrls and deniedUrls names. The old config.json link is removed by linkGeneration when it still points into a generation; a regular file left by Copilot CLI stays for it to manage. The news entry and release note tell users whose Copilot CLI already wrote a regular settings.json to remove it before switching, since the new link would collide with it.
This commit is contained in:
@@ -1,4 +1,8 @@
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inlineAgent = ''
|
||||
---
|
||||
@@ -38,7 +42,6 @@ in
|
||||
settings = {
|
||||
model = "claude-sonnet-4-5";
|
||||
theme = "dark";
|
||||
trusted_folders = [ "/home/user/projects" ];
|
||||
};
|
||||
context = inlineContext;
|
||||
agents = {
|
||||
@@ -54,52 +57,54 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.copilot/config.json
|
||||
assertFileContent home-files/.copilot/config.json ${./expected-config.json}
|
||||
nmt.script =
|
||||
assert !(config.home.activation ? githubCopilotCliSettings);
|
||||
''
|
||||
assertPathNotExists home-files/.copilot/config.json
|
||||
assertFileContent home-files/.copilot/settings.json ${./expected-config.json}
|
||||
|
||||
assertFileExists home-files/.copilot/copilot-instructions.md
|
||||
assertFileContent home-files/.copilot/copilot-instructions.md \
|
||||
${builtins.toFile "expected-copilot-instructions.md" inlineContext}
|
||||
assertFileExists home-files/.copilot/copilot-instructions.md
|
||||
assertFileContent home-files/.copilot/copilot-instructions.md \
|
||||
${builtins.toFile "expected-copilot-instructions.md" inlineContext}
|
||||
|
||||
assertFileExists home-files/.copilot/agents/inline-reviewer.agent.md
|
||||
assertFileContent home-files/.copilot/agents/inline-reviewer.agent.md \
|
||||
${builtins.toFile "expected-inline-reviewer.agent.md" inlineAgent}
|
||||
assertFileExists home-files/.copilot/agents/inline-reviewer.agent.md
|
||||
assertFileContent home-files/.copilot/agents/inline-reviewer.agent.md \
|
||||
${builtins.toFile "expected-inline-reviewer.agent.md" inlineAgent}
|
||||
|
||||
assertFileExists home-files/.copilot/agents/path-reviewer.agent.md
|
||||
assertLinkExists home-files/.copilot/agents/path-reviewer.agent.md
|
||||
assertFileContent home-files/.copilot/agents/path-reviewer.agent.md \
|
||||
${./agents/documentation.agent.md}
|
||||
assertFileExists home-files/.copilot/agents/path-reviewer.agent.md
|
||||
assertLinkExists home-files/.copilot/agents/path-reviewer.agent.md
|
||||
assertFileContent home-files/.copilot/agents/path-reviewer.agent.md \
|
||||
${./agents/documentation.agent.md}
|
||||
|
||||
assertFileExists home-files/.copilot/agents/store-reviewer.agent.md
|
||||
assertLinkExists home-files/.copilot/agents/store-reviewer.agent.md
|
||||
assertFileContent home-files/.copilot/agents/store-reviewer.agent.md \
|
||||
${storeAgentSrc}
|
||||
assertFileExists home-files/.copilot/agents/store-reviewer.agent.md
|
||||
assertLinkExists home-files/.copilot/agents/store-reviewer.agent.md
|
||||
assertFileContent home-files/.copilot/agents/store-reviewer.agent.md \
|
||||
${storeAgentSrc}
|
||||
|
||||
assertFileExists home-files/.copilot/skills/inline-skill/SKILL.md
|
||||
assertFileContent home-files/.copilot/skills/inline-skill/SKILL.md \
|
||||
${builtins.toFile "expected-inline-skill.md" inlineSkill}
|
||||
assertFileExists home-files/.copilot/skills/inline-skill/SKILL.md
|
||||
assertFileContent home-files/.copilot/skills/inline-skill/SKILL.md \
|
||||
${builtins.toFile "expected-inline-skill.md" inlineSkill}
|
||||
|
||||
assertFileExists home-files/.copilot/skills/path-skill/SKILL.md
|
||||
assertLinkExists home-files/.copilot/skills/path-skill/SKILL.md
|
||||
assertFileContent home-files/.copilot/skills/path-skill/SKILL.md \
|
||||
${./test-skill.md}
|
||||
assertFileExists home-files/.copilot/skills/path-skill/SKILL.md
|
||||
assertLinkExists home-files/.copilot/skills/path-skill/SKILL.md
|
||||
assertFileContent home-files/.copilot/skills/path-skill/SKILL.md \
|
||||
${./test-skill.md}
|
||||
|
||||
assertFileExists home-files/.copilot/skills/dir-skill/SKILL.md
|
||||
assertFileExists home-files/.copilot/skills/dir-skill/notes.txt
|
||||
assertLinkExists home-files/.copilot/skills/dir-skill/SKILL.md
|
||||
assertLinkExists home-files/.copilot/skills/dir-skill/notes.txt
|
||||
assertFileContent home-files/.copilot/skills/dir-skill/SKILL.md \
|
||||
${./skills/data-analysis/SKILL.md}
|
||||
assertFileContent home-files/.copilot/skills/dir-skill/notes.txt \
|
||||
${./skills/data-analysis/notes.txt}
|
||||
assertFileExists home-files/.copilot/skills/dir-skill/SKILL.md
|
||||
assertFileExists home-files/.copilot/skills/dir-skill/notes.txt
|
||||
assertLinkExists home-files/.copilot/skills/dir-skill/SKILL.md
|
||||
assertLinkExists home-files/.copilot/skills/dir-skill/notes.txt
|
||||
assertFileContent home-files/.copilot/skills/dir-skill/SKILL.md \
|
||||
${./skills/data-analysis/SKILL.md}
|
||||
assertFileContent home-files/.copilot/skills/dir-skill/notes.txt \
|
||||
${./skills/data-analysis/notes.txt}
|
||||
|
||||
assertFileExists home-files/.copilot/skills/store-skill/SKILL.md
|
||||
assertLinkExists home-files/.copilot/skills/store-skill/SKILL.md
|
||||
assertFileContent home-files/.copilot/skills/store-skill/SKILL.md \
|
||||
"${storeSkillSrc}/skills/external-skill/SKILL.md"
|
||||
assertFileExists home-files/.copilot/skills/store-skill/SKILL.md
|
||||
assertLinkExists home-files/.copilot/skills/store-skill/SKILL.md
|
||||
assertFileContent home-files/.copilot/skills/store-skill/SKILL.md \
|
||||
"${storeSkillSrc}/skills/external-skill/SKILL.md"
|
||||
|
||||
assertPathNotExists home-files/.copilot/mcp-config.json
|
||||
assertFileNotRegex home-path/etc/profile.d/hm-session-vars.sh 'COPILOT_HOME'
|
||||
'';
|
||||
assertPathNotExists home-files/.copilot/mcp-config.json
|
||||
assertFileNotRegex home-path/etc/profile.d/hm-session-vars.sh 'COPILOT_HOME'
|
||||
'';
|
||||
}
|
||||
|
||||
@@ -7,5 +7,6 @@
|
||||
github-copilot-cli-path-not-directory = ./path-not-directory.nix;
|
||||
github-copilot-cli-store-path-dir = ./store-path-dir.nix;
|
||||
github-copilot-cli-store-path-skills = ./store-path-skills.nix;
|
||||
github-copilot-cli-trusted-folders = ./trusted-folders.nix;
|
||||
github-copilot-cli-xdg-config-dir = ./xdg-config-dir.nix;
|
||||
}
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
{
|
||||
"firstLaunchAt": "1970-01-01T00:00:00.000Z",
|
||||
"model": "claude-sonnet-4-5",
|
||||
"theme": "dark",
|
||||
"trusted_folders": [
|
||||
"/home/user/projects"
|
||||
]
|
||||
"theme": "dark"
|
||||
}
|
||||
|
||||
@@ -20,5 +20,7 @@
|
||||
assertFileExists home-files/.copilot/mcp-config.json
|
||||
assertFileContent home-files/.copilot/mcp-config.json ${./expected-mcp-config.json}
|
||||
assertPathNotExists home-files/.copilot/config.json
|
||||
assertPathNotExists home-files/.copilot/settings.json
|
||||
assertFileNotRegex activate 'githubCopilotCliSettings|github-copilot-cli-settings.json'
|
||||
'';
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
{ config, ... }:
|
||||
{
|
||||
programs.github-copilot-cli = {
|
||||
enable = true;
|
||||
settings.trusted_folders = [ "/home/user/projects" ];
|
||||
};
|
||||
|
||||
test.asserts.warnings.expected = [
|
||||
''
|
||||
programs.github-copilot-cli.settings: trusted_folders and trustedFolders
|
||||
are not written to settings.json. Copilot CLI keeps trusted folders in
|
||||
its own state; trust folders from Copilot CLI instead.
|
||||
''
|
||||
];
|
||||
|
||||
nmt.script =
|
||||
assert !(config.home.activation ? githubCopilotCliSettings);
|
||||
''
|
||||
assertPathNotExists home-files/.copilot/settings.json
|
||||
assertPathNotExists home-files/.copilot/config.json
|
||||
'';
|
||||
}
|
||||
@@ -2,17 +2,18 @@
|
||||
home.preferXdgDirectories = true;
|
||||
programs.github-copilot-cli = {
|
||||
enable = true;
|
||||
package = null;
|
||||
context = ./context.md;
|
||||
settings = {
|
||||
model = "claude-sonnet-4-5";
|
||||
theme = "dark";
|
||||
trusted_folders = [ "/home/user/projects" ];
|
||||
};
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.config/copilot/config.json
|
||||
assertFileContent home-files/.config/copilot/config.json ${./expected-config.json}
|
||||
assertPathNotExists home-files/.config/copilot/config.json
|
||||
assertFileContent home-files/.config/copilot/settings.json ${./expected-config.json}
|
||||
assertPathNotExists home-files/.copilot/settings.json
|
||||
assertFileExists home-files/.config/copilot/copilot-instructions.md
|
||||
assertLinkExists home-files/.config/copilot/copilot-instructions.md
|
||||
assertFileContent home-files/.config/copilot/copilot-instructions.md \
|
||||
|
||||
Reference in New Issue
Block a user