Files
lux/modules/capabilities/ai.nix
T
2026-09-05 15:27:19 +02:00

108 lines
3.9 KiB
Nix

{ inputs, config, ... }:
let
hmModules = config.flake.modules.homeManager;
nixosModules = config.flake.modules.nixos;
in
{
flake.modules.nixos.ai =
{ pkgs, ... }:
{
imports = [ nixosModules.podman ];
home-manager.sharedModules = [ hmModules.ai ];
nixpkgs.overlays = [ inputs.llm-agents.overlays.shared-nixpkgs ];
nix.settings = {
extra-substituters = [ "https://cache.numtide.com" ];
extra-trusted-public-keys = [
"niks3.numtide.com-1:DTx8wZduET09hRmMtKdQDxNNthLQETkc/yaX7M4qK0g="
];
};
services.ollama = {
enable = true;
package = pkgs.ollama-vulkan;
loadModels = [ "nomic-embed-text" ];
};
};
flake.modules.homeManager.ai =
{ pkgs, ... }:
{
services.podman = {
volumes = {
grounded-docs-config = { };
grounded-docs-data = { };
};
containers.grounded-docs = {
image = "ghcr.io/arabold/docs-mcp-server:2.4.0";
network = "host";
volumes = [
"grounded-docs-config.volume:/config"
"grounded-docs-data.volume:/data"
];
environment = {
DOCS_MCP_APP_TELEMETRY_ENABLED = "false";
DOCS_MCP_EMBEDDING_MODEL = "openai:nomic-embed-text";
DOCS_MCP_EMBEDDINGS_VECTOR_DIMENSION = "768";
OPENAI_API_BASE = "http://127.0.0.1:11434/v1";
OPENAI_API_KEY = "ollama";
};
exec = "--protocol http --host 127.0.0.1 --port 6280";
};
};
programs.mcp = {
enable = true;
servers.nixos = {
command = "${pkgs.uv}/bin/uvx";
args = [ "mcp-nixos" ];
};
};
home.packages = [
pkgs.llm-agents.codex
pkgs.llm-agents.pi
pkgs.llm-agents.claude-code
pkgs.llm-agents.herdr
pkgs.ctx7
];
home.file.".codex/AGENTS.md".text = ''
# Environment
This is Nix; use `nix run` for missing commands.
- Default Nix commands to `--quiet`; inspect logs only for failing derivations.
- Never emit full package, derivation, closure, GC, or store-tree listings. Capture them in `/tmp`, summarize or filter, then inspect targeted excerpts.
- For store sources, locate files first, then read exact ranges; avoid broad `rg -C` searches.
# Work
- Inspect the relevant implementation and follow project conventions.
- Prefer the simplest complete solution.
- Identify and address root causes rather than masking symptoms.
- Prefer existing capabilities and defaults. Add custom code, wrappers, helpers, defensive checks, fallbacks, compatibility layers, or abstractions only for a concrete need.
- Delete unnecessary code; keep related logic together.
- Use types, schemas, and interfaces to prevent invalid states where practical.
- Keep changes focused; preserve behavior unless requested or fixing a confirmed defect.
- Verify unfamiliar, version-sensitive, or consequential APIs against current documentation; prefer context7.
- Run the most relevant checks; report only verification performed.
# Reviews and refactoring
- Inspect complete relevant context, not just the obvious file or diff.
- Find unnecessary or duplicated code, redundant state, avoidable checks, reimplemented capabilities, and repeated defaults.
- Ask whether defensive code protects a realistic state or hides an unclear invariant.
- Optimize conceptual complexity, not line count.
- Separate confirmed problems from optional improvements; explain important tradeoffs.
# Context
Every action must justify its context. Minimize tools and skills; prefer targeted queries and bounded output. Ask for readily available large output instead of retrieving it.
'';
};
}