mirror of
https://github.com/nix-community/home-manager.git
synced 2026-12-06 04:40:17 +00:00
Copilot CLI ignores trusted folders in settings.json and keeps them in config.json, its own state file that also holds login and plugin state. The module therefore left them out of settings.json, which left no declarative way to trust folders. Add a trustedFolders option that merges the declared folders into config.json's trustedFolders list at activation. Only that key is changed: folders trusted from inside Copilot CLI are kept, and removing a folder from Nix does not untrust it. config.json is read as JSON5 because Copilot CLI starts it with a comment header, and a new file is created with mode 600 as Copilot CLI does. The warning for the old settings keys now points to the new option.
41 lines
1.4 KiB
Nix
41 lines
1.4 KiB
Nix
{
|
|
config,
|
|
...
|
|
}:
|
|
{
|
|
programs.github-copilot-cli = {
|
|
enable = true;
|
|
mutableSettings = true;
|
|
settings = {
|
|
model = "claude-sonnet-4-5";
|
|
theme = "dark";
|
|
# Copilot CLI keeps trusted folders in its own state, so both spellings
|
|
# are left out of the file.
|
|
trusted_folders = [ "/home/user/projects" ];
|
|
trustedFolders = [ "/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; use programs.github-copilot-cli.trustedFolders instead.
|
|
''
|
|
];
|
|
|
|
# The merge itself is covered by the mkImpureConfigMerger tests; this checks
|
|
# what the module passes to it.
|
|
nmt.script =
|
|
assert config.home.activation.githubCopilotCliSettings.after == [ "linkGeneration" ];
|
|
assert !(config.home.activation ? githubCopilotCliImmutableSettings);
|
|
''
|
|
assertPathNotExists home-files/.copilot/config.json
|
|
assertPathNotExists home-files/.copilot/settings.json
|
|
assertFileContains activate 'Merging Nix-generated config into /home/hm-user/.copilot/settings.json'
|
|
assertFileRegex activate '/bin/pyjson5 --as-json'
|
|
generated="$(grep -o '/nix/store/[^ ]*-github-copilot-cli-settings.json' "$TESTED/activate" | head -n1)"
|
|
assertFileContent "$generated" ${./expected-config.json}
|
|
'';
|
|
}
|