Skip to content

Template: Bug Reproduction

The bogus template helps you create minimal bug reproductions. Use it when reporting issues or contributing fixes.

Terminal window
mkdir bogus && cd bogus
nix flake init -t github:vic/den#bogus
nix flake update den
flake.nix
modules/
bug.nix # your bug reproduction
test-base.nix # test infrastructure (DO NOT EDIT)

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;
}
);
};
}

denTest is a helper that:

  1. Creates a fresh Den evaluation with your module
  2. Provides helpers like igloo (host config), tuxHm (user’s HM config)
  3. Compares expr against expected using nix-unit

Available test helpers (from test-base.nix):

HelperDescription
igloonixosConfigurations.igloo.config
icebergnixosConfigurations.iceberg.config
tuxHmigloo.home-manager.users.tux
pinguHmigloo.home-manager.users.pingu
funnyNamesResolves an aspect for class "funny" and collects .names
showbuiltins.trace helper for debugging
Terminal window
nix flake check

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.

If you’re submitting a fix to Den, test against your local checkout:

Terminal window
cd <den-working-copy>
nix flake check --override-input den . ./templates/bogus
FeatureProvided
nix-unit test infrastructure
Pre-configured denTest helper
Version matrix testing
Common test helpers
Contribute Community Sponsor