一键导入
debugging
Troubleshoot Nix evaluation and build errors
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Troubleshoot Nix evaluation and build errors
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
Create and modify NixOS and Home-Manager modules
Hardens systemd services against security issues using sandboxing, capability restriction, and syscall filtering. Use when creating or modifying systemd services, writing NixOS modules with systemd.services, reviewing service security, or whenever a serviceConfig block is involved. Ensures services follow defense-in-depth principles with minimal privilege.
Write Nix code using repo conventions
Write and review Conventional Commits commit messages (v1.0.0) for semantic versioning and changelogs. Use when drafting git commit messages, PR titles, release notes, or enforcing conventional commit format like `type(scope): subject`, `BREAKING CHANGE`, footers, and `revert`.
Manages version control with Jujutsu (jj), including rebasing, conflict resolution, and Git interop. Use when tracking changes, navigating history, squashing/splitting commits, or pushing to Git remotes.
Manage background jobs, capture command output, and handle session multiplexing. Use when running long commands, capturing output from detached processes, or managing concurrent tasks in headless environments.
基于 SOC 职业分类
| name | debugging |
| description | Troubleshoot Nix evaluation and build errors |
Add trace statements to see values during evaluation:
let
myValue = builtins.trace "myValue is: ${toString someVar}" someVar;
in
# myValue prints during evaluation
For complex values:
builtins.trace (builtins.toJSON someAttrSet) someAttrSet
Test expressions without building:
# Evaluate specific option
nix eval .#nixosConfigurations.nixdev.config.networking.hostName
# Check if something evaluates
nix eval .#nixosConfigurations.nixdev.config.services.nginx.enable
# Evaluate with trace output visible
nix eval .#nixosConfigurations.nixdev.config.system.build.toplevel --apply 'x: "ok"'
nix build .#nixosConfigurations.nixdev.config.system.build.toplevel --show-trace
Error: infinite recursion encountered
Causes:
Fix: Check imports and option definitions for circular dependencies.
Error: attribute 'foo' missing
Causes:
Fix:
# List available attributes
nix eval .#nixosConfigurations.nixdev.config.services --apply 'builtins.attrNames'
Error: value is a string while a list was expected
Causes:
Fix: Check option type definition and provided value.
Error: assertion ... failed
Causes:
Fix: Read assertion message and provide required config.
# For failed derivation
nix log /nix/store/...-derivation.drv
# Or from error output
nix log <drv-path-from-error>
nix build .#package -L
nix develop .#nixosConfigurations.nixdev.config.system.build.toplevel
nix eval .#nixosConfigurations.nixdev.config.services.myService.enable
nix eval .#nixosConfigurations.nixdev.options.services.myService --apply 'builtins.attrNames'
nix eval .#nixosConfigurations.nixdev.options.services.nginx.enable.definitionsWithLocations
nix flake check --no-build
nix flake show
nix eval .#nixosConfigurations --apply 'builtins.attrNames'
nix eval .#homeConfigurations --apply 'builtins.attrNames'
| Problem | Command |
|---|---|
| Does it evaluate? | nix eval .#... --apply 'x: "ok"' |
| What options exist? | nix eval .#...options --apply 'builtins.attrNames' |
| What is value? | nix eval .#...config.<path> |
| Where is error? | nix build --show-trace |
| What failed in build? | nix log <drv> |
| Is syntax valid? | nix flake check --no-build |