Template: Bug Reproduction
The bogus template helps you create minimal bug reproductions. Use it when reporting issues or contributing fixes.
Initialize
Section titled “Initialize”mkdir bogus && cd bogusnix flake init -t github:vic/den#bogusnix flake update denProject Structure
Section titled “Project Structure”flake.nixmodules/ bug.nix # your bug reproduction test-base.nix # test infrastructure (DO NOT EDIT)Writing a Bug Reproduction
Section titled “Writing a Bug Reproduction”Edit modules/bug.nix with a minimal test case:
{ denTest, ... }:{ flake.tests.bogus = { test-something = denTest ( { den, lib, igloo, tuxHm, ... }: { den.hosts.x86_64-linux.igloo.users.tux = { };
# set up the scenario den.aspects.igloo.nixos.something = true;
# what you get expr = igloo.something; # what you expect expected = true; } ); };}How denTest Works
Section titled “How denTest Works”denTest is a helper that:
- Creates a fresh Den evaluation with your module
- Provides helpers like
igloo(host config),tuxHm(user’s HM config) - Compares
expragainstexpectedusing nix-unit
Available test helpers (from test-base.nix):
| Helper | Description |
|---|---|
igloo | nixosConfigurations.igloo.config |
iceberg | nixosConfigurations.iceberg.config |
tuxHm | igloo.home-manager.users.tux |
pinguHm | igloo.home-manager.users.pingu |
funnyNames | Resolves an aspect for class "funny" and collects .names |
show | builtins.trace helper for debugging |
Run Tests
Section titled “Run Tests”nix flake checkTesting Against Different Den Versions
Section titled “Testing Against Different Den Versions”Edit .github/workflows/test.yml to test against multiple Den versions:
strategy: matrix: rev: ["main", "v1.0.0", "abc1234"]This helps identify regressions — include "main" and any release tag or commit.
Contributing a Fix
Section titled “Contributing a Fix”If you’re submitting a fix to Den, test against your local checkout:
cd <den-working-copy>nix flake check --override-input den . ./templates/bogusWhat It Provides
Section titled “What It Provides”| Feature | Provided |
|---|---|
| nix-unit test infrastructure | ✓ |
| Pre-configured denTest helper | ✓ |
| Version matrix testing | ✓ |
| Common test helpers | ✓ |
Next Steps
Section titled “Next Steps”- Share your reproduction repo on GitHub Discussions
- Read Debug Configurations for debugging techniques
- See the CI Tests template for Den’s own comprehensive test suite