Skip to content

Programs

Source directory: modules/programs/

1password.nix

modules/programs/1password.nix

No option declarations; see source for implementation.

agent-team.nix

modules/programs/agent-team.nix

One role map for Claude Code, Codex and agy (#3263).

No option declarations; see source for implementation.

agent-voice.nix

modules/programs/agent-voice.nix

  • Enable option: spoken summaries when Claude Code or Codex finishes a turn

Options: enable, package, backend, claudeModel, ollamaUrl, model, speaker, minTurnSeconds, startEnabled, moreKey, toggleKey, ignore

Options declaration (Nix)
  options.features.agentVoice = {
    enable = mkEnableOption "spoken summaries when Claude Code or Codex finishes a turn";

    package = mkOption {
      type = types.package;
      default = pkgs.customPkgs.agent-say.override { omarchyVoice = hmVoice.package; };
      defaultText = literalExpression "pkgs.customPkgs.agent-say.override { omarchyVoice = <omarchy-voice package>; }";
      description = "agent-say, built on omarchy-voice's Python.";
    };

    agents = {
      claude.enable = mkOption { type = types.bool; default = true; description = "Hook Claude Code's Stop event."; };
      codex.enable = mkOption { type = types.bool; default = true; description = "Hook Codex's Stop event (managed hook)."; };
      agy.enable = mkOption { type = types.bool; default = true; description = "Hook agy's Stop event (entry in ~/.gemini/config/hooks.json)."; };
    };

    voice.elevenLabsVoiceId = mkOption {
      type = types.str;
      default = "pFZP5JQG7iQjIQuC4Bku";
      description = "ElevenLabs voice for the narrator (Lily).";
    };

    voice.elevenLabsKeyFile = mkOption {
      type = types.nullOr types.str;
      default = null;
      description = "File holding the ElevenLabs key, read at run time when ELEVENLABS_API_KEY is unset. When set, the narrator uses ElevenLabs with this key, ignoring the keyring and omarchy-voice's elevenlabs.enabled; if it cannot be read, those apply as usual.";
    };

    summary = {
      backend = mkOption { type = types.enum [ "ollama" "claude" ]; default = "ollama"; description = "What writes the summary: local Ollama, or `claude -p`."; };
      claudeModel = mkOption { type = types.str; default = "haiku"; description = "Model for the claude backend."; };
      ollamaUrl = mkOption { type = types.str; default = "http://127.0.0.1:11434"; description = "Ollama endpoint that writes the summary."; };
      model = mkOption { type = types.str; default = "qwen3:14b"; description = "Ollama model that writes the summary."; };
    };

    speaker = mkOption {
      type = types.enum [ "agent-say" "nixi" ];
      default = "agent-say";
      description = "Who speaks the summary. \"agent-say\" is its own voice; \"nixi\" hands the summary to Nixi, falling back to agent-say's voice only when Nixi is not running.";
    };

    minTurnSeconds = mkOption { type = types.int; default = 60; description = "Turns shorter than this stay silent."; };
    startEnabled = mkOption { type = types.bool; default = true; description = "Speak by default; `agent-say off` mutes at runtime."; };

    moreKey = mkOption {
      type = types.str;
      default = "SUPER + ALT + I";
      description = "Hyprland key that speaks the long version of the last turn. Empty disables it.";
    };

    toggleKey = mkOption {
      type = types.str;
      default = "SUPER + SHIFT + ALT + V";
      description = "Hyprland key that toggles spoken summaries on/off. Empty disables it.";
    };

    microphoneGate = {
      enable = mkOption { type = types.bool; default = true; description = "Stay silent while an application is capturing the microphone."; };
      ignore = mkOption {
        type = types.listOf types.str;
        default = [ "Echo-Cancel Capture" "Echo-Cancel Sink" "parecord" ];
        description = "Capture streams (application.name, else media.name) that do not count as a call.";
      };
    };
  }

chrome-pwa-icons.nix

modules/programs/chrome-pwa-icons.nix

Chrome PWA Icon Sync

Chromium-based browsers install PWAs as .desktop files referencing icons by bare name (Icon=chrome--Profile_) but store the actual PNG files only inside ~/.config/google-chrome/Profile /Web Applications/Manifest Resources//Icons/. That path is not on any XDG icon search path, so launchers (COSMIC, GNOME) fall back to a generic placeholder.

This module installs a per-user oneshot service + timer that symlinks every Chrome-downloaded PWA icon into ~/.local/share/icons/hicolor/x/apps/ and refreshes the GTK icon cache. Idempotent, fast, and reversible.

Tracked in issue #397.

  • Enable option: Chrome PWA icon sync into the XDG hicolor tree
Options declaration (Nix)
  options.modules.programs.chrome-pwa-icons = {
    enable = lib.mkEnableOption "Chrome PWA icon sync into the XDG hicolor tree";

    user = lib.mkOption {
      type = lib.types.str;
      example = "alice";
      description = ''
        User whose Chrome profiles will be scanned and whose
        ~/.local/share/icons/hicolor tree will receive the symlinks.
      '';
    };

    syncIntervalMinutes = lib.mkOption {
      type = lib.types.ints.between 0 1440;
      default = 15;
      description = ''
        How often the timer fires while the user is logged in. Set to 0 to
        disable the timer (the service still runs once at login).
      '';
    };
  }

claude-code-managed.nix

modules/programs/claude-code-managed.nix

Claude Code managed-settings.json

Renders /etc/claude-code/managed-settings.json — Claude Code's highest- precedence config layer. The CLI reads this file but NEVER writes to it, making the read-only nix-store backing both safe and correct.

Use this for settings the user must not be able to disable from the CLI (PARR hooks, baseline permissions, apiKeyHelper). User-scope preferences like statusLine and enabledPlugins should NOT live here — see the init- template pattern in home/development/claude-code-lsp.nix instead. Two exceptions: an organization mod, which only counts as one when managed enabledPlugins names it (modules/programs/claude-code-mods.nix, #2218), and a plugin declared off, which a synced user-scope true cannot undo (#2831).

Reference: https://code.claude.com/docs/en/settings.md Tracked in issue #398.

  • Enable option: Claude Code managed-settings.json (read-only baseline)
  • Enable option: Claude Code notification hooks (Notification/Stop/SubagentStop)
Options declaration (Nix)
  options.modules.programs.claude-code-managed = {
    enable = lib.mkEnableOption "Claude Code managed-settings.json (read-only baseline)";

    settings = lib.mkOption {
      type = lib.types.attrsOf lib.types.anything;
      default = { };
      example = lib.literalExpression ''
        {
          permissions.deny = [ "Bash(rm -rf /*)" ];
          apiKeyHelper = "/run/wrappers/bin/op-claude-key";
        }
      '';
      description = ''
        Settings to write into /etc/claude-code/managed-settings.json.
        Claude Code reads this with highest precedence and never writes back.
        Anything here is effectively unmodifiable from the CLI/UI.
      '';
    };

    # settings.hooks is a freeform value, so two modules defining one event conflict; these lists concatenate.
    extraHooks = lib.mkOption {
      type = lib.types.attrsOf (lib.types.listOf lib.types.anything);
      default = { };
      description = "Hooks added per event to settings.hooks by modules that share an event.";
    };

    agentTeam.enable = lib.mkOption {
      type = lib.types.bool;
      default = true;
      description = "Codex/agy agent-team switch and its per-prompt mode hook (issue 2650).";
    };

    parrProtocol.enable = lib.mkOption {
      type = lib.types.bool;
      default = true;
      description = ''
        Inject the PARR (Plan, Act, Reflect, Revise) UserPromptSubmit hook.
        Equivalent to the previous programs.claudeCode.hooks.enableParrProtocol
        option, but enforced from managed scope so the user cannot disable it
        by editing ~/.claude/settings.json.
      '';
    };

    baselineAllow.enable = lib.mkOption {
      type = lib.types.bool;
      default = true;
      description = ''
        Auto-approve a curated baseline of safe, read-only / build / test /
        format commands (nix build/eval/fmt, just validate/test-*, read-only
        git, statix/deadnix/alejandra) via managed-scope permissions.allow, so
        routine repo operations never trigger a permission prompt. System-
        mutating commands (deploys, nixos-rebuild, git commit/push, sudo, rm)
        are deliberately excluded and still require explicit approval.
      '';
    };

    subagentMetadata.enable = lib.mkOption {
      type = lib.types.bool;
      default = true;
      description = ''
        Publish the live Claude Code Task-subagent count to herdr as a pane
        metadata token, rendered by the $agents entry in the sidebar row
        config (home/development/herdr.nix).

        Subagents run in-process with no PTY, so herdr cannot represent them as
        their own agent rows; this makes an otherwise invisible fan-out visible
        on the parent pane. No-ops outside a herdr pane.
      '';
    };

    subagentMetadata.codex = lib.mkOption {
      type = lib.types.bool;
      default = false;
      description = ''
        Publish observed Codex worker turns to Herdr's agents token. Codex
        0.173 omits the start of a follow-up and the stop of an interrupted
        worker. Ending or replacing the root session clears its count.
      '';
    };

    sharedCheckoutGuard.enable = lib.mkOption {
      type = lib.types.bool;
      default = true;
      description = ''
        Veto Claude Code Bash calls that would change the branch checked out
        in ~/.config/nixos (/etc/nixos), via a managed-scope PreToolUse hook.
        Every deploy builds whatever that checkout has checked out, so it
        stays on main and branch work happens in a git worktree (#2052).
        File restores (`git checkout -- <path>`), switching to main and
        `git worktree add` are unaffected. SHARED_CHECKOUT_BRANCH_OK=1 in the
# … truncated — see source link above

claude-code-mods.nix

modules/programs/claude-code-mods.nix

  • Enable option: Claude Code mods shipped from pkgs/claude-code-mods

Options: enable

Options declaration (Nix)
  options.modules.programs.claude-code-mods = {
    enable = mkEnableOption "Claude Code mods shipped from pkgs/claude-code-mods";
    fleetGuard.enable = mkOption {
      type = types.bool;
      default = true;
      description = "fleet-guard: #agents band, /announce, commit and home-manager guards (managed scope).";
    };
    nixFlavour.enable = mkOption {
      type = types.bool;
      default = true;
      description = "nix-flavour: NixOS spinner words and host/generation/theme status line (user scope).";
    };
  }

claude-router-cli.nix

modules/programs/claude-router-cli.nix

Claude Code router CLI — switches repos between local Ollama (via LiteLLM on p620) and cloud Anthropic API per repository.

Phase 3 of docs/plans/2026-05-22-ollama-p620-litellm-design.md. Depends on Phase 1 (Ollama on p620) + Phase 2 (LiteLLM proxy on p620).

What this module installs:

  1. claude-router CLI on system PATH: claude-router use-ollama — writes /.claude/settings.json with ANTHROPIC_BASE_URL pointing at the right router URL (loopback on p620, Tailscale on razer) claude-router use-claude — removes the override (back to api.anthropic.com) claude-router use-default — alias for use-claude claude-router status — prints which backend the current repo uses

  2. claude-router-key helper script for Claude Code's apiKeyHelper: inspects ANTHROPIC_BASE_URL and emits the right bearer key:

  3. router URL → /run/agenix/api-router- (LiteLLM bearer)
  4. default URL → /run/agenix/api-anthropic (cloud Anthropic) This is auto-wired into modules.programs.claude-code-managed.settings.apiKeyHelper.

  5. Slash command markdown files at /etc/claude-code/commands/ for users who want the slash-command UX. Home Manager users can symlink them into ~/.claude/commands/ (a HM stanza is provided in the user's profile for olafkfreund — see Users/olafkfreund/profile.nix).

Network endpoint selection happens at write-time in claude-router use-ollama: - on p620 → http://127.0.0.1:4000 (loopback, sub-ms) - elsewhere → https://p620..ts.net/router (Tailscale)

The bearer key for the router and the key for cloud Anthropic are BOTH agenix-managed; the user never types them.

  • Enable option: claude-router CLI + apiKeyHelper for routing Claude Code between local Ollama and cloud Anthropic
Options declaration (Nix)
  options.modules.programs.claude-router-cli = {
    enable = lib.mkEnableOption "claude-router CLI + apiKeyHelper for routing Claude Code between local Ollama and cloud Anthropic";

    routerHostKey = lib.mkOption {
      type = lib.types.str;
      default = "api-router-${config.networking.hostName}";
      description = ''
        Name of the agenix secret holding this host's bearer key for the
        LiteLLM router. Defaults to api-router-<hostname>.
      '';
    };
  }

claude-swarm-reaper.nix

modules/programs/claude-swarm-reaper.nix

  • Enable option: reaping orphaned and idle Claude Code swarm tmux servers

Options: enable, idleMinutes, intervalMinutes, dryRun

Options declaration (Nix)
  options.features.claudeSwarmReaper = {
    enable = mkEnableOption "reaping orphaned and idle Claude Code swarm tmux servers";
    idleMinutes = mkOption { type = types.int; default = 10; description = "Minutes a teammate may sit idle before its pane is killed."; };
    intervalMinutes = mkOption { type = types.int; default = 2; description = "How often the reaper runs."; };
    dryRun = mkOption { type = types.bool; default = true; description = "Log what would be killed and kill nothing."; };
  }

dconf.nix

modules/programs/dconf.nix

No option declarations; see source for implementation.

default.nix

modules/programs/default.nix

No option declarations; see source for implementation.

droidcam.nix

modules/programs/droidcam.nix

No option declarations; see source for implementation.

firefox.nix

modules/programs/firefox.nix

No option declarations; see source for implementation.

gnupg.nix

modules/programs/gnupg.nix

No option declarations; see source for implementation.

nix-ld.nix

modules/programs/nix-ld.nix

No option declarations; see source for implementation.

nixi-agent-hooks.nix

modules/programs/nixi-agent-hooks.nix

  • Enable option: Nixi hooks for Claude Code, Codex and agy (approve, result, working signal; #211)
Options declaration (Nix)
  options.features.nixiAgentHooks.enable = mkEnableOption "Nixi hooks for Claude Code, Codex and agy (approve, result, working signal; #211)";

  config = mkIf cfg.enable {
    modules.programs.claude-code-managed.extraHooks = {
      UserPromptSubmit = [{ hooks = [{ type = "command"; command = nixi "attention --from claude --hook"; timeout = 5; }]; }];
      # The turn end (Stop, StopFailure) and "finished"/"needs you" (Notification) switch the working code off
      # (nixoarchy-snowflake #149: needs nixi-companion >= 1.9.0, an older one shows "finished" on every Stop).
      Stop = [{ hooks = [{ type = "command"; command = nixi "attention --from claude --hook"; timeout = 5; }]; }];
      StopFailure = [{ hooks = [{ type = "command"; command = nixi "attention --from claude --hook"; timeout = 5; }]; }];
      Notification = [{ hooks = [{ type = "command"; command = nixi "attention --from claude --hook"; timeout = 5; }]; }];
    } // optionalAttrs (has "claude") {
      PermissionRequest = [{ hooks = [{ type = "command"; command = nixi "approve --from claude"; timeout = 75; }]; }];
      PostToolUse = [{ hooks = [{ type = "command"; command = nixi "result --from claude"; timeout = 5; }]; }];
      PostToolUseFailure = [{ hooks = [{ type = "command"; command = nixi "result --from claude"; timeout = 5; }]; }];
    };

    environment.etc."codex/hooks/nixi-working".source = codexHook "nixi-working" "attention --from codex --hook";
    environment.etc."codex/hooks/nixi-approve" = mkIf (has "codex") { source = codexHook "nixi-approve" "approve --from codex"; };
    environment.etc."codex/hooks/nixi-result" = mkIf (has "codex") { source = codexHook "nixi-result" "result --from codex"; };
    environment.etc."codex/requirements.toml".text = mkAfter (
      codexEntry "UserPromptSubmit" "nixi-working" 5
      + optionalString (has "codex") (codexEntry "PermissionRequest" "nixi-approve" 75 + codexEntry "PostToolUse" "nixi-result" 5)
    );

    # ~/.gemini is Syncthing-synced, so merge into hooks.json instead of
    # replacing it. Writes go through a temp file so a dry run publishes nothing.
    home-manager.users.olafkfreund = { lib, ... }: {
      home.activation.nixiAgentAgyHook = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
        hooksfile="$HOME/.gemini/config/hooks.json"
        jq=${pkgs.jq}/bin/jq
        if [ -f "$hooksfile" ] && $jq -e 'type == "object"' "$hooksfile" >/dev/null 2>&1; then
          if ! $jq -e --slurpfile want ${agyHookEntry} '."nixi-working" == $want[0]."nixi-working"' "$hooksfile" >/dev/null 2>&1; then
            tmp=$(mktemp)
            $jq -s '.[0] + .[1]' "$hooksfile" ${agyHookEntry} > "$tmp"
            $DRY_RUN_CMD mv "$tmp" "$hooksfile"
          fi
        fi
      '';
    };
  }

wshowkeys.nix

modules/programs/wshowkeys.nix

No option declarations; see source for implementation.

yt-x.nix

modules/programs/yt-x.nix

  • Enable option: yt-x terminal YouTube browser

Options: enable

Options declaration (Nix)
  options.features.programs.yt-x = {
    enable = mkEnableOption "yt-x terminal YouTube browser";
  }