Running tests
nix flake check runs them all.
Test structure
Module tests
Verify that NixOS configurations evaluate without errors for various feature combinations:| Test | Description |
|---|---|
eval-minimal | Minimal NixOS modules import |
eval-desktop | Desktop feature flag |
eval-development | Development feature flag |
eval-all-features | All features enabled together |
eval-themes | Theme configurations |
eval-keyboard | Keyboard layouts and IME |
eval-graphics-* | GPU configurations (Intel, AMD, NVIDIA, PRIME) |
Library tests
Unit tests for lib functions using theassertTest helper.
Writing tests
Module evaluation test
Add totests/module-tests.nix:
testNixOS helper evaluates the NixOS config without building derivations. The withTestUser helper merges your config with a minimal bootable config (grub disabled, root filesystem, stateVersion).
Library test
Add totests/lib-tests.nix:
CI pipeline
The GitHub Actions workflow (.github/workflows/validate.yml) runs three stages:
- Lints —
nix fmt -- --ci(formatting check) - Check —
nix flake check(all evaluation tests) - Build — Full system build (runs after lints and check pass)