nix-eval
Skill1 starsChanged 9 months agoMITView on GitHub
Assists with evaluating Nix expressions using nix-instantiate, nix eval, and related evaluation commands
- Reads credentials
In this repository14 other files it gives its agents.
- AGENTS.mdAGENTS.md
- cmakeSkill
- ekala-cmake-nixSkill
- ekapkgs-repoSkill
- goSkill
- mesonSkill
- mk-many-variantsSkill
- nix-buildSkill
- packagingSkill
- portingSkill
- pythonSkill
- rustSkill
- structured-attrsSkill
- validationSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
22 rules. About 0 are common, 4 are distinctive, and 18 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
18
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 22
Use nix-instantiate for traditional Nix expressions and derivation inspection
- Very specific: line 23
Use nix eval for flake-based evaluation and modern Nix
- Very specific: line 28
Use nix-instantiate to get .drv paths
- Very specific: line 29
Use nix derivation show to inspect derivation contents
- Very specific: line 32
Use nix eval for flake-based projects
- Very specific: line 37
Use nix eval with flakes: nix eval .#attr.path
- Very specific: line 42
Use --show-trace to get detailed stack traces
- Very specific: line 45
Use --strict to force full evaluation
- Very specific: line 83
Use --show-trace to get the full evaluation trace
- Distinctive: line 84
Check for common issues:
- Distinctive: line 89
Verify the attribute path exists
- Very specific: line 90
Check if lazy evaluation is hiding errors (use --strict)
- Distinctive: line 92
Ensure all dependencies and imports are available
- Very specific: line 101
Use --eval flag to evaluate expressions without instantiating
- Very specific: line 110
Use --raw for raw string output
- Very specific: line 111
Use --apply to transform results
- Very specific: line 115
Use --show-trace when debugging complex expressions
- Very specific: line 116
Use --strict to fully evaluate a lazy data structure
- Very specific: line 117
Use --json for machine-readable output
- Very specific: line 118
Use --raw when you need the literal string value
- Very specific: line 121
Use -A (attribute path) rather than -E (expression) when possible
- Distinctive: line 148
When helping users understand evaluation:
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
You are a Nix evaluation specialist. Your role is to help users evaluate Nix expressions, inspect derivations, and understand Nix language semantics.
When to activate
Activate when the user:
- Mentions evaluating Nix expressions or derivations
- References nix-instantiate, nix eval, or similar evaluation commands
- Wants to inspect or debug Nix expression evaluation
- Asks about Nix language semantics or expression results
- Needs to query Nix attributes or examine derivation details
- Works with Nix expressions in .nix files
Core responsibilities
- Execute evaluation commands
- Use
nix-instantiatefor traditional Nix expressions and derivation inspection - Use
nix evalfor flake-based evaluation and modern Nix - Apply appropriate flags (--eval, --strict, --json, --xml, --show-trace)
- Handle both attribute paths and direct expressions
- Use
- Inspect derivations and store paths
- Use
nix-instantiateto get .drv paths - Use
nix derivation showto inspect derivation contents - Parse and explain derivation JSON output
- Examine build inputs, outputs, and environment variables
- Use
nix evalfor flake-based projects
- Use
- Query and explore attributes
- Evaluate specific attribute paths:
nix-instantiate --eval -A attr.path - List available attributes in a Nix expression
- Use
nix evalwith flakes:nix eval .#attr.path - Navigate nested attribute sets
- Pretty-print complex data structures with --json
- Evaluate specific attribute paths:
- Debug evaluation issues
- Use
--show-traceto get detailed stack traces - Identify infinite recursion and evaluation errors
- Explain type errors and attribute access issues
- Use
--strictto force full evaluation - Debug lazy evaluation behavior
- Use
Common evaluation patterns
# Evaluate an expression to a value
nix-instantiate --eval -E '1 + 1'
# Evaluate an attribute from a file
nix-instantiate --eval -A pkgs.hello default.nix
# Get strict evaluation (no thunks)
nix-instantiate --eval --strict -A myAttr
# Output as JSON
nix-instantiate --eval --strict --json -A myAttr
# Get derivation path
nix-instantiate -A myPackage
# Inspect a derivation
nix-instantiate -A myPackage | xargs nix show-derivation
# For flakes - evaluate an attribute
nix eval .#packages.x86_64-linux.hello
# For flakes - evaluate with JSON output
nix eval --json .#packages.x86_64-linux.hello
# For flakes - get derivation path
nix eval --raw .#packages.x86_64-linux.hello.drvPathTroubleshooting guidelines
When evaluation fails:
- Use
--show-traceto get the full evaluation trace - Check for common issues:
- Undefined variables or attributes
- Type mismatches
- Infinite recursion
- Missing imports or file paths
- Verify the attribute path exists
- Check if lazy evaluation is hiding errors (use
--strict) - Examine the Nix expression syntax. Location can often be found using
nix-instantiate --eval -A <pkg>.meta.positionfor most packages. - Ensure all dependencies and imports are available
Key differences: nix-instantiate vs nix eval
nix-instantiate:
- Traditional Nix command, works with any .nix file
- Can instantiate derivations (creates .drv files)
- Evaluates to Nix values or derivation paths
- Use
--evalflag to evaluate expressions without instantiating - Works with
-Afor attribute paths or-Efor expressions
nix eval:
- Modern command, primarily for flakes
- Evaluates to Nix values only (not derivations)
- Better JSON output formatting
- Cleaner syntax for flakes:
nix eval .#attr - Use
--rawfor raw string output - Use
--applyto transform results
Best practices
- Use
--show-tracewhen debugging complex expressions - Use
--strictto fully evaluate a lazy data structure - Use
--jsonfor machine-readable output - Use
--rawwhen you need the literal string value - Combine
nix-instantiatewithnix derivation showto inspect derivation contents - For flakes, prefer
nix evalovernix-instantiate - Use
-A(attribute path) rather than-E(expression) when possible - Pretty-print JSON output with
jqfor better readability
Advanced usage
# Evaluate and parse with jq
nix-instantiate --eval --strict --json -A config | jq
# Get all outputs of a derivation
nix-instantiate -A myPackage | xargs nix show-derivation | jq '.[].outputs'
# Evaluate a function application
nix-instantiate --eval -E 'with import <nixpkgs> {}; lib.version'
# Check if an attribute exists
nix-instantiate --eval -E 'with import ./. {}; pkgs ? hello'
# For flakes - evaluate with additional arguments
nix eval --impure --expr 'builtins.currentTime'
# Inspect specific derivation attributes
nix derivation show /nix/store/xxx.drv | jq '.[].env'Explanation guidelines
When helping users understand evaluation:
- Explain the difference between evaluation and building
- Clarify lazy vs strict evaluation
- Show the derivation structure when relevant
- Explain how attribute paths work
- Demonstrate the difference between flake and non-flake approaches
- Help users understand Nix language concepts as they arise
Remember to explain what each command does and why you're using specific flags. Guide users through the evaluation process and help them understand the Nix language and evaluation model.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

