Imported from rudenkornk/dotfiles (
AGENTS.md). Install upstream withnpx skills add rudenkornk/dotfiles. Copyright stays with the author.
AI Instructions for dotfiles Repository
Repository Overview
This repository defines a reproducible NixOS and Home Manager setup through Nix flakes. It includes a Python CLI, Neovim (LazyVim), tmux, fish, and development toolchains.
Development and Validation
Command Execution
Run ordinary commands, including Git, searches, and installed tools, directly in the normal shell environment.
Use nix run . -- <command> for the repository management CLI.
The flake app supplies the CLI's Python environment and tools; no manual dependency installation is needed.
For example, use nix run . -- hooks to install the repository hooks.
See readme.md for bootstrap and recovery instructions.
Validation Policy
For routine changes, run nix run . -- format (or nix run . -- format --check) and nix run . -- lint.
Formatting also runs ruff check --fix --unsafe-fixes; lint includes strict mypy and full-history gitleaks scanning.
The complete formatter and linter lists live in dotfiles_py/targets/lint.py.
Run any checks specific to the changed behavior before finishing.
Keep Nix configuration evaluation and build checks rare, and only at the end of the entire change set.
Keep Nix configuration evaluation and build checks rare and at the end of the change set.
When required, the flake check must be the final validation step, after all changes and other checks are complete.
All required checks must pass before the final commit or reporting completion.
If validation requires further edits, rerun the affected checks and keep any required flake check last.
CI runs the same checks; see .github/workflows/workflow.yml.
If lint reports that git history is shallow, run git fetch --unshallow and rerun lint.
Use this documented workaround rather than investigating alternatives.
Repository Map and Conventions
flake.nixdefines flake outputs;flake.lockpins dependencies.nix/tooling.nixdefines the CLI package, default app, and development shells.nix/configuration.nixandnix/home.nixare the system and Home Manager entry points.nix/hosts/andnix/users/hold machine and user definitions; hardware configuration is inlined per host.nix/home-manager/holds program/category modules, configs, scripts, and dotfiles. Neovim's Lua configuration is innix/home-manager/text-editors/neovim/config/.nix/modules/holds local modules;nix/overlays/holds package overlays.nix/packages/holds standalone packages;nix/unfree.nixis the unfree-package allowlist.dotfiles_py/cli.pydefines CLI commands,targets/implements them, andutils.pyprovides shared utilities. Hooks and scripts live indotfiles_py/data/.
Nix Conventions
- Add new Nix and configuration files to the git staging area so the flake can see them.
- The default package set is stable;
pkgs.unstableprovides packages from a separate input. - Home Manager configurations cover every configured
user@hostpair and are registered as flake checks. local.home.fileinnix/modules/home/links directory trees into$HOMEone file at a time, allowing several modules to populate a shared target directory.
Overlay Rules
nix/overlays/unstable.nixintroducespkgs.unstablefrom thenixpkgs-unstableinput and auto-loads native overlays from regularnix/overlays/unstable/*.nixfiles.- Put each
pkgs.unstableamendment in its own file undernix/overlays/unstable/. Do not define package-specific overrides directly inunstable.nix. Each amendment must have the shapefinal: prev: { ... }and must not accept repository arguments. nix/overlays/custom.nixmaps each regularnix/overlays/custom/<name>.nixmodule topkgs.custom.<name>. Each module must have the shapefinal: prev: derivation.- The custom loader is not recursive, so keep package modules at the root of
custom/. - Store all non-Nix custom package assets under
nix/overlays/custom/scripts/, using package-specific subdirectories where useful. - Store all package patches in
nix/overlays/patches/and reference them viafinal.locallib.patches + /<name>.patch.pkgs.unstablealso carrieslocallib, so the same reference works insidenix/overlays/unstable/.
Secrets Management
Secrets in nix/secrets/ use sops + age with the custom local.secrets modules in nix/modules/secrets/,
not community sops-nix.
Configurations must still evaluate without decrypted secrets.
.sops.yamldefines recipients and encryption rules, including TPM-bound identities. Private keys live in~/.config/sops/and/root/.config/sops/, preserved across reboots bynix/disk.nix.nix run . -- updatekeysindotfiles_py/targets/secrets.pyre-encrypts secrets after recipient changes.nix/overlays/custom/scripts/sops-cached.shdecrypts into/run/user/$UID/secrets/(tmpfs), caches results, and optionally symlinks them to their target paths. Both system and userdecrypt-secrets.serviceunits use it.nix/overlays/locallib/with_secrets.nixusesbash_secrets.nixto inject decrypted environment variables at launch. This wrapper is used by all AI CLI tools and Neovim.- The pre-commit hook blocks plaintext secret filenames and scans the staged diff with gitleaks.
AI tools are denied access to secrets directories.
nix/overlays/sops.nixruns the secret editor withunshare --netand restricted vim.
Code Style Guidelines
- Python: Strict mypy, ruff with "ALL" rules (see pyproject.toml ignores), 120 char line length, no docstrings for most functions
- Nix: nixfmt with --strict, statix linting
- Shell: shellcheck, shfmt (2-space indents from .editorconfig)
- Markdown: 180 char line length, HTML allowed
- YAML: 120 char line length, no document-start
- Lua: stylua (2-space indents)
- KDL: kdlfmt
Trust These Instructions
Use the documented workflows. Look up additional information only for task-specific details not covered here or errors without a documented workaround.