Diagnoses slow Nix flake operations (nix develop, direnv allow, nix flake archive) on fresh checkouts. Analyzes lockfile shape, identifies duplicate inputs and self-recursion, and guides reducing the input graph with follows.
Ships in juspay. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Before optimizing anything, pin down which command the user runs and time each on a fresh state (cleared eval cache + cold /nix/store for an honest measurement):
| Command | What it does | Bottleneck |
|---|---|---|
nix develop --command true | Lazy: fetches only inputs whose outputs the devShell eval touches | Eval + minimal substitution |
nix print-dev-env | Same laziness as above; what plain nix-direnv use flake invokes | Same as above |
nix flake archive --no-write-lock-file | Eager: fetches every node in flake.lock into the store | Total lock-graph size |
nix build .#default | Eval + realize closure | Eval + builds not in cache |
The "direnv takes 10 minutes" complaint usually maps to nix flake archive (nix-direnv with input pre-caching enabled, or wrappers that warm the store for offline use), not to nix print-dev-env. Confirm which one is slow before you start optimizing — lazy eval is invariant to lockfile bloat; eager archive isn't.
Use nix run nixpkgs#jq on flake.lock to extract:
.nodes | keys | length) — gross size of the input graphnarHash count ([.nodes[].locked.narHash] | unique | length) — actual number of distinct sources nix would fetch on a cold machine. Duplicate nodes pointing at the same store path don't add fetches.original.repo / original.url, sort by count. Many copies of nixpkgs, flake-utils, flake-parts, nix-systems/default is normal; very large counts mean missing follows.followsFor each transitive duplicate that has a sibling at the root, add inputs.X.inputs.Y.follows = "Y". You can chain: inputs.A.inputs.B.inputs.C.follows = "C". The rules:
flake-parts, flake-utils, git-hooks-nix, treefmt-nix, fourmolu-nix, nix-systems) at the root's copy. These are eval-only and version-tolerant.foo lists your-flake as an input, follow the inner your-flake's sub-inputs back to the root (inputs.foo.inputs.your-flake.inputs.bar.follows = "bar"). Also follow inputs.foo.inputs.your-flake.inputs.foo.follows = "foo" to break the recursion at one level.nixpkgs or haskell-flake to a different revision than what its lockfile pinned. This changes hash propagation and triggers cabal/Haskell rebuilds. Only do it if you're explicitly bumping that downstream.narHash you'd pick anyway. Lockfile gets renumbered, fetch count doesn't change.After each change run nix flake lock and re-measure both node count and unique-narHash count. Commit only changes that move the unique-narHash number.
For cold-fetch numbers, use a fresh VM. On juspay infrastructure: pu create --name X, ship the repo snapshot with git archive <ref> | ssh X 'tar -x -C /tmp/...', time the operation, then pu destroy X and recreate for the next sample so /nix/store starts empty. Don't try to simulate cold by deleting paths from a live /nix/store — the nix-daemon protects flake-input paths as live roots and --ignore-liveness doesn't always evict them.
For eval-only numbers (no fetch), keep /nix/store warm and clear ~/.cache/nix/eval-cache-v* between runs. Median of 3–5 runs.
Always record both numbers separately. Eval improvements and fetch improvements look very different and conflating them produces misleading PR descriptions.
Stop optimizing when the remaining lockfile duplicates are at distinct revisions (different repos pinning different nixpkgs revs, for instance). Further consolidation requires bumping inputs, which is a separate decision from input-graph hygiene.
nix-for-dev (this repo) — flake.nix structure conventions (zero-inputs + npins)nix-health (this repo) — substituters, max-jobs, trusted-users checks that also gate first-fetch speedfollows, flake = false, etc.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
/juspay:nix-perffrom juspay
npx claudepluginhub juspay/skills --plugin juspay17 skills in this plugin
/cargo-watchRun cargo-watch in the background for continuous clippy feedback during code editing./nix-bunUse this when building a Bun (bun.lock) project with Nix. Covers bun2nix, the bun.nix dependency workflow, the bun --compile top-level-await pitfall, and a CI drift check./nix-ciUse this when setting up CI for a GitHub repository — offers GitHub Actions or Vira depending on the project/nix-for-devUse this when setting up Nix for a development project (devShell + package build) and you care about `nix develop` being fast. Covers the zero-inputs flake.nix + npins + default.nix/shell.nix layout, sub-flakes for non-user-facing Nix, and language-specific recommendations./nix-haskellUse this when working on a Haskell project with Nix. Covers haskell-flake setup, adding/overriding dependencies, package settings, and devShell configuration./nix-healthUse this when diagnosing or fixing a user's Nix installation — checks flakes, version, caches, max-jobs, direnv, rosetta, trusted-users, and shell configOther plugins' skills for the same job