Develop, debug, and iterate on Nix expressions.
Capabilities
This skill provides access to Nix tooling for development work:
nix eval - Evaluate Nix expressions and inspect values
nix build - Build derivations
nix flake check - Validate flake
nix flake show - Show flake outputs
nix repl - Interactive exploration (use --expr for non-interactive)
nix-instantiate - Debug derivations
Common Workflows
Evaluate an expression:
nix eval .#nixosConfigurations.hostname.config.services.nginx.enable
Evaluate with JSON output:
nix eval --json .#nixosConfigurations.hostname.config.networking.firewall.allowedTCPPorts
Debug a module option:
nix eval .#nixosConfigurations.hostname.config.homelab --apply builtins.attrNames
Check derivation without building:
nix-instantiate --eval -E 'with import <nixpkgs> {}; lib.version'
Build and check:
nix build .#nixosConfigurations.hostname.config.system.build.toplevel --dry-run
Explore flake outputs:
nix flake show --json | jq '.nixosConfigurations | keys'
Debugging Tips
Type errors:
nix eval --show-trace .#problematic.expression
Infinite recursion:
nix eval --show-trace --option eval-max-statements 100000 .#expression
Check option types:
nix eval .#nixosConfigurations.host.options.services.nginx.enable.type.name
Rules
Follow Nix debugging rules from CLAUDE.md. Run nix flake check to validate after changes.