Validation is a critical step before any deployment. The homelab follows the philosophy: “nix flake check is the law.” Always validate before deploying.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/soriphoono/homelab/llms.txt
Use this file to discover all available pages before exploring further.
Why Validation Matters
Validation prevents:- Syntax errors in Nix expressions
- Type mismatches and incorrect options
- Missing dependencies or broken imports
- Failed deployments that could leave systems in broken states
- Time wasted on deployments that will fail
Primary Validation Command
The main validation command checks all configurations in your flake:- All NixOS system configurations (
nixosConfigurations) - All Home Manager configurations (
homeConfigurations) - All Nix-on-Droid configurations (
nixOnDroidConfigurations) - Development shells and packages
- Flake structure and metadata
Validation Workflow
Review output
Look for any errors or warnings in the output. The check will fail if any configuration has issues.
Validation Options
What Gets Validated
The flake includes comprehensive evaluation checks:Security Validation
The homelab includes a security audit tool:- vulnix - Scans for known security vulnerabilities in dependencies
- nix flake check - Standard configuration validation
Whitelist Management
Accepted vulnerabilities are documented invulnix-whitelist.toml:
Targeted Validation
Validate Specific Configuration
Check a single system without validating everything:Validate Flake Metadata
Check flake structure and inputs:Validate Flake Schema
Ensure flake outputs are correctly structured:Pre-commit Validation
The repository includes automatic validation via git hooks:Continuous Integration
GitHub Actions automatically validate on push:Common Validation Errors
Syntax Errors
Error:error: syntax error, unexpected '}'
Solution: Check for missing semicolons, brackets, or quotes in Nix files.
Missing Options
Error:error: The option 'services.xyz' does not exist
Solution:
- Check option name spelling
- Verify the module providing the option is imported
- Check NixOS option search: https://search.nixos.org
Type Mismatches
Error:error: value is a list while a set was expected
Solution: Review the option’s expected type and correct your configuration.
Import Errors
Error:error: file 'path/to/module.nix' was not found
Solution:
- Verify file path is correct
- Ensure file exists in repository
- Check for typos in import statements
Infinite Recursion
Error:error: infinite recursion encountered
Solution:
- Check for circular imports
- Review
lib.mkIf,lib.mkDefault, andlib.mkOverrideusage - Look for self-referential definitions
Validation Best Practices
Test incrementally
Make small changes and validate each one. Don’t accumulate multiple changes before validation.
Validation vs. Testing
Validation (Evaluation)
Validation ensures configuration is syntactically correct and evaluates properly:Testing (Build + Test)
Testing actually builds and can test the configuration:Updating Before Validation
When updating inputs, validate afterward:Debugging Validation Failures
Get Detailed Error Information
Isolate the Problem
- Comment out recent changes
- Run validation after each uncomment
- Identify which change causes the failure
- Fix that specific change