Practices

From indexable-inc/index-bak · View interactive version

Practices is an AI agent skill from the GitHub repository indexable-inc/index-bak. Nix patterns to improve when touching nearby code: precise types, source filtering, getExe, mkPackageOption/mkEnableOption, follows. Use when writing or refactoring Nix.

How to use this skill

Skill file

Nix practices to tighten

Improve these patterns when touching nearby code. If cleanup is wider than the

task, file a narrow issue.

format boundaries.

repeatedly. getExe reads meta.mainProgram; reach for getExe' pkg "name"

when the package ships multiple binaries.

nix flake check internally. Model dependencies as derivation inputs or keep

orchestration outside Nix.

the need belongs.

commit -- ix had exec nix run .#lint there and removed it. A commit hook

earns its place only by being narrow and fast (ix's scans astlog over the

staged .nix files), and it must print what it did NOT check, or a green

hook gets read as a green lint.

mkDerivation { inherit version; ... }. finalAttrs:` is the canonical

self-reference (we ban rec), and overrides propagate cleanly.

package = mkOption { type = types.package; default = pkgs.<name>; };. It

produces consistent defaultText, example, and the nullable

no-install path for free.

default = false; description = "Whether to enable ..."; }`. Pass a bare noun

phrase; the helper renders "Whether to enable <noun>." itself.

set defaultText = lib.literalExpression "..." so the generated option docs

show the expression instead of the resolved store path.

meta.mainProgram when the derivation ships a binary, and a passthru.tests

entry for cheap smoke tests.

{file}, {option}, {command}, {env}, {manpage}. The renderer

consumes them; even without rendering, they encode intent.

flake input that itself takes a nixpkgs. Each unfollowed nixpkgs duplicates

the evaluator's working set.

autoreconfHook, makeWrapper, wrapGAppsHook all belong in

nativeBuildInputs, never buildInputs. The splicing in buildInputs

swaps them to the target platform and silently breaks the build.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.