nix-debugger

Diagnose unexpected Nix rebuilds, slow builds, and silent failures using plan scoring and provenance tools.

Updated Aug 5, 2026
One-click install
npx skills add https://github.com/harivansh-afk/loom-index-e2e --skill nix-debugger-harivansh-afk
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: nix-debugger
Source: https://github.com/harivansh-afk/loom-index-e2e/tree/main/skills/nix/debugger
Command: npx skills add https://github.com/harivansh-afk/loom-index-e2e --skill nix-debugger-harivansh-afk

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Nix builds sometimes rebuild packages that should not have changed, deploys trigger unnecessary service restarts, and failure excerpts hide the actual error behind noisy output. This Skill provides a measurement-first workflow to find the real cause from data that already exists, instead of guessing. ## Core Features & Use Cases - Rebuild cause analysis: Use nix-dag to score a build plan from evaluation alone, ranking nodes whose dependents reach them only through an environment variable naming the store path. - Full log retrieval: Use nix log on the derivation path to read complete build logs when the printed failure excerpt contains only noise from a chatty post-failure phase. - Provenance and diffing: Use whence to trace which .nix file installed a package, nix store builds --json to inspect in-flight daemon builds, and normalized diffs to tell real unit changes from pure store-path bumps across generations. - Use Case: A deploy restarted a service and you need to know whether the unit actually changed. Diff the two generations' unit files with store hashes normalized; if byte-identical, run nix-dag on the closure to find the edge carrying the unneeded store path. ## Quick Start Ask the AI to find out why a Nix package rebuilt unexpectedly using nix-dag and whence on the current generation.

Frequently Asked Questions about nix-debugger

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I find out why a Nix package rebuilt?▼

Run nix-dag on the installable to score the build plan from evaluation alone. Read the sole count in the ranking: a node reached only through an environment variable naming its store path causes rebuilds nobody asked for.

How to see the full Nix build log when the error is missing?▼

Run nix log on the derivation path, obtained from nix eval --raw .#<attr>.drvPath. The failure excerpt nix prints is a fixed tail, so a chatty phase after the error can push the diagnostic out of view.

How do I check which Nix file installed a package?▼

Use whence <path|pname> to read the live generation's provenance.json with zero evaluation. For fleet NixOS hosts without the manifest, use options.<name>.definitionsWithLocations via nix eval instead.

Can I check Nix expression errors without building?▼

Yes, run nix eval --raw .#<attr>.drvPath to prove the expression is sound without building. A single eval over nixosConfigurations with an apply function finds every host's eval errors across a fleet at once.

Why does a systemd unit change on every NixOS deploy?▼

Often only store hashes moved, not the unit content. Diff the unit files across two generations with store paths normalized via sed; if byte-identical, the unit carries a store path it does not need.

What are the limitations of whence for package provenance?▼

whence only knows generations that ship provenance.json: the home-manager profile and, on darwin, /run/current-system. Fleet NixOS hosts ship neither, so whence returns command-not-found and the eval-time route is required.