2.home-manager/tests/modules/programs/gemini-cli/settings.nix
Austin Horstman b61330163e tests/gemini-cli: add policy assertions
Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
2026-03-17 23:46:59 -05:00

54 lines
1.7 KiB
Nix

{
programs.gemini-cli = {
enable = true;
defaultModel = "gemini-2.5-flash";
settings = {
theme = "Default";
vimMode = true;
preferredEditor = "nvim";
autoAccept = true;
};
commands = {
changelog = {
prompt = ''
Your task is to parse the `<version>`, `<change_type>`, and `<message>` from their input and use the `write_file` tool to correctly update the `CHANGELOG.md` file.
'';
description = "Adds a new entry to the project's CHANGELOG.md file.";
};
"git/fix" = {
prompt = "Please analyze the staged git changes and provide a code fix for the issue described here: {{args}}.";
description = "Generates a fix for a given GitHub issue.";
};
};
policies = {
"my-rules" = {
rule = [
{
toolName = "run_shell_command";
commandPrefix = "git ";
decision = "ask_user";
priority = 100;
}
];
};
"other-rules" = ./other-rules.toml;
};
};
nmt.script = ''
assertFileExists home-files/.gemini/settings.json
assertFileContent home-files/.gemini/settings.json \
${./settings.json}
assertFileContent home-files/.gemini/commands/changelog.toml \
${./changelog.toml}
assertFileContent home-files/.gemini/commands/git/fix.toml \
${./fix.toml}
assertFileContent home-files/.gemini/policies/my-rules.toml \
${./my-rules.toml}
assertFileContent home-files/.gemini/policies/other-rules.toml \
${./other-rules.toml}
assertFileExists home-path/etc/profile.d/hm-session-vars.sh
assertFileContains home-path/etc/profile.d/hm-session-vars.sh \
'export GEMINI_MODEL="gemini-2.5-flash"'
'';
}