Nix Best Practices
Ensures Nix expressions adhere to best practices, promoting reproducibility, maintainability, and efficient builds.
Install on your platform
We auto-selected Claude Code based on this skill’s supported platforms.
Run in terminal (recommended)
claude mcp add nix-best-practices npx -- -y @trustedskills/nix-best-practices
Or manually add to ~/.claude/settings.json
{
"mcpServers": {
"nix-best-practices": {
"command": "npx",
"args": [
"-y",
"@trustedskills/nix-best-practices"
]
}
}
}Requires Claude Code (claude CLI). Run claude --version to verify your install.
About This Skill
The nix-best-practices skill equips AI agents with deep knowledge of NixOS system administration, enabling them to write idiomatic configuration files and troubleshoot complex dependency issues. It ensures generated code adheres to community standards for reproducibility, security, and maintainability within the Nix ecosystem.
When to use it
- Configuring a new NixOS workstation or server with specific hardware requirements.
- Refactoring legacy shell scripts into declarative Nix expressions for better version control.
- Debugging build failures caused by conflicting package versions or environment variables.
- Setting up reproducible development environments that match production exactly.
Key capabilities
- Generates valid
configuration.nixandflake.nixfiles following current best practices. - Advises on proper use of overlays, flakes, and channel management.
- Identifies common anti-patterns like mutable state or hardcoded paths in Nix code.
- Provides solutions for dependency resolution and cross-compilation challenges.
Example prompts
"Create a flake.nix that builds a Rust project with specific compiler flags." "How do I configure NixOS to enable SSH access only from my home network?" "Explain why my Nix build is failing due to a hash mismatch and how to fix it."
Tips & gotchas
Ensure your AI agent has access to the latest Nix documentation or flake.lock files, as best practices evolve rapidly. Avoid asking the agent to modify system files directly; instead, have it generate configuration snippets for review before applying them via nixos-rebuild.
Tags
TrustedSkills Verification
Unlike other registries that point to live repositories, TrustedSkills pins every skill to a verified commit hash. This protects you from malicious updates — what you install today is exactly what was reviewed and verified.
Security Audits
| Gen Agent Trust Hub | Pass |
| Socket | Pass |
| Snyk | Pass |
🌐 Community
Passed automated security scans.