nix-repro-env

Inspect Nix flake outputs and select correct CLI entrypoints for reproducible commands.

Updated Apr 15, 2025
One-click install
npx skills add https://github.com/khrore/nix-config --skill nix-repro-env
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: nix-repro-env
Source: https://github.com/khrore/nix-config/tree/main/dotfiles/common/.config/opencode/skills/nix-repro-env
Command: npx skills add https://github.com/khrore/nix-config --skill nix-repro-env

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires nix, python3, git, and includes scripts (resource) and references (resource) components.

What problem does it solve?

Ensures Nix commands run in an explicit, pinned, and reproducible environment by inspecting flake outputs, selecting the correct entrypoint, and diagnosing evaluation or execution failures caused by missing attrs, wrong systems, private inputs, lockfile drift, or impurity.

Core Features & Use Cases

  • Flake inspection: Summarizes available outputs such as packages, apps, devShells, checks, nixosConfigurations, and darwinConfigurations.
  • Command selection: Guides choosing between nix run, nix develop, and nix shell and prefers the narrowest, reproducible entrypoint.
  • Execution helpers: Provides scripts to inspect outputs, launch commands inside a dev shell, and emit concise reproducibility reports.
  • Debugging: Classifies failures (missing attrs, wrong system, private inputs, impurity, dirty tree or lock drift) and points to targeted checks and fixes.
  • Use Case: When a flake is host-oriented or uses private inputs and you must run or explain a command reproducibly and unambiguously.

Quick Start

Inspect the flake outputs, select the exact attr and system, and run the chosen command inside the pinned dev shell or with nix run to produce a reproducible result.

Frequently Asked Questions about nix-repro-env

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

FAQPage Schema
How do I run Nix flake commands reproducibly without eval failures?

To run Nix flake commands reproducibly, inspect the flake outputs, select the exact attr and system, and execute via the pinned devShell or nix run to ensure an explicit, locked environment.

Why does my Nix flake devShell fail due to wrong system or missing attrs?

Nix flake devShell failures occur when the target system selection is incorrect or required output attributes are missing. Diagnosing these failures involves classifying the error and checking the flake.lock for drift or private inputs.

Can I use Nix flakes with private inputs without passing --impure?

Nix flakes with private inputs can be run without --impure by inspecting the flake.lock to identify the inputs and selecting the narrowest reproducible entrypoint, avoiding impurity unless strictly necessary for evaluation.

How do I choose between nix run, nix develop, and nix shell for a flake?

Choose between nix run, nix develop, and nix shell by inspecting the available flake outputs such as apps and devShells, preferring the narrowest entrypoint that provides a reproducible execution environment for your specific task.

Do I need git and python3 to troubleshoot Nix flake reproducibility issues?

Yes, troubleshooting Nix flake reproducibility requires git and python3 to run the inspection and execution scripts that analyze flake.nix and flake.lock, classify failures, and generate reproducibility reports.

What is the best way to debug lockfile drift in a Nix flake environment?

The best way to debug lockfile drift in a Nix flake environment is to inspect the flake.lock against flake.nix, classify the failure type, and use targeted checks to restore the pinned, reproducible state.