nixos/utils/home-manager/claude-code/settings.nix
Dominik Polakovics 248534bc35 feat(dev): deploy claude-code config via systemd instead of home-manager
Home-manager fails on the dev microVM because nix-env --set needs
writable nix state dirs, but the microVM shares /nix/store read-only
via virtiofs.

Extract shared claude-code settings into settings.nix, add a NixOS
module (nixos.nix) that deploys the same files via a systemd oneshot
service with RequiresMountsFor to handle virtiofs mount ordering.
The nb host continues using home-manager unchanged.
2026-02-06 22:49:55 +01:00

44 lines
2.7 KiB
Nix

{ homeDir }:
{
env = {
CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS = "1";
};
statusLine = {
type = "command";
command = "${homeDir}/.claude/statusline-command.sh";
};
hooks.Stop = [
{
hooks = [{
type = "agent";
agent = "secret-scanner";
prompt = "First: if stop_hook_active is true in the hook input, allow stopping immediately. Second: run `git diff HEAD` and `git diff --cached` using the Bash tool if BOTH are empty, allow stopping immediately (no changes to check). Otherwise: Scan the diff for accidentally committed secrets. Check .claude/secret-scanner.md for project-specific allowlists. If secrets are found, they must be removed before the session can end. If no secrets found, allow stopping.";
timeout = 120;
}];
}
{
hooks = [{
type = "agent";
agent = "lint-fixer";
prompt = "First: if stop_hook_active is true in the hook input, allow stopping immediately. Second: run `git diff HEAD` and `git diff --cached` using the Bash tool if BOTH are empty, allow stopping immediately (no changes to check). Otherwise: Run the project's linter/formatter. Check .claude/lint-fixer.md for project-specific config. If that file doesn't exist, auto-detect the linter and run it. Auto-fix what you can, report unfixable errors as blocking. If no linter detected, allow stopping.";
timeout = 180;
}];
}
{
hooks = [{
type = "agent";
agent = "test-runner";
prompt = "First: if stop_hook_active is true in the hook input, allow stopping immediately. Second: run `git diff HEAD` and `git diff --cached` using the Bash tool if BOTH are empty, allow stopping immediately (no changes to check). Otherwise: Check if .claude/test-runner.md exists in the current working directory. If it does NOT exist, allow stopping immediately do not attempt to auto-detect or run any tests. If it DOES exist, read it and follow its instructions to run the project's tests. If tests fail, they must be fixed before the session can end.";
timeout = 300;
}];
}
{
hooks = [{
type = "agent";
agent = "devil-advocate";
prompt = "First: if stop_hook_active is true in the hook input, allow stopping immediately. Second: run `git diff HEAD` and `git diff --cached` using the Bash tool if BOTH are empty, allow stopping immediately (no changes to check). Otherwise: Review all code changes. Read the project's .claude/devil-advocate.md for project-specific conventions. Report any CRITICAL or HIGH issues found. If there are CRITICAL or HIGH issues, they must be fixed before the session can end.";
timeout = 600;
}];
}
];
}