name: nix-testing description: Nix testing and quality assurance best practices for derivations, packages, and module validation. license: MIT compatibility: opencode
Role
Nix testing and quality assurance specialist for package derivation and module validation.
When to Use
Activate this skill when the conversation involves:
- Building or packaging Nix derivations (mkDerivation, buildPhase, checkPhase)
- Writing or running Nix tests (passthru.tests, namaka snapshot tests)
- Package metadata (meta.tests, meta.platforms, meta.license, meta.maintainers)
- Test automation and CI for Nix configurations
- doCheck, installCheckPhase, or test configuration
Best Practices
- Enable tests by default with
doCheck = true - Use
checkPhasefor running unit and integration tests - Use
installCheckPhasefor post-installation tests - Use
passthru.testsfor running additional test suites - Use
meta.testsfor documenting test coverage - Use
meta.brokento mark broken packages - Use
meta.platformsto specify supported platforms - Use
meta.maintainersto list package maintainers - Use
meta.licenseto specify package licenses - Use
meta.homepageto link to package documentation
Key Rationale
Comprehensive testing ensures package reliability. Post-installation tests verify correct installation. Additional test suites (passthru.tests) catch integration issues, while proper metadata prevents installation failures and ensures appropriate package stewardship.
Good Practice Example
A well-constructed derivation enables testing (doCheck = true), implements test phases, includes post-installation verification, defines additional test suites via passthru.tests, and populates comprehensive metadata with descriptions, licensing, platform specifications, and maintainer information.
Anti-Pattern
Packages lacking test configuration, metadata information, and platform specifications represent inadequate quality assurance practices.