Skip to content

Templates Overview

Den ships several templates that cover progressively complex setups. Use nix flake init to scaffold a new project:

Terminal window
nix flake init -t github:denful/den#<template>
TemplateUse caseFlakesflake-partsHome-Manager
minimalSmallest possible Den setup
defaultRecommended starting point
exampleFeature showcase with namespaces
noflakeStable Nix, no flakes
nvf-standaloneDen based NVF without NixOS
microvmMicroVM host and guests
flake-parts-modulesflake-parts perSystem submodules
bogusBug reproduction
ciDen’s own test suite

The following are not nix flake init templates — they are demo directories that live in the Den repository. Their flake.nix references Den via a relative path:../.., so they only resolve from inside a checkout of the repo. To explore one, clone the repo and copy templates/<demo>/ out as your starting point, or run the commands on its page from the repo root.

DemoUse caseFlakesflake-partsHome-Manager
fleet-demoMulti-host fleet with environments
terranix-demoTerraform config from den hosts
Terminal window
mkdir my-nix && cd my-nix
nix flake init -t github:denful/den
nix flake update den

This clones the default template. Edit modules/hosts.nix to declare your machines, then:

Terminal window
nix run .#vm

Every template follows the same pattern:

flake.nix # or default.nix for noflake
modules/
den.nix # host/user declarations + den.flakeModule import
*.nix # aspect definitions, one concern per file

Den uses import-tree to recursively load all .nix files under modules/. You never need to manually list imports — just create files.

  • minimal — The absolute minimum: one host, one user, no extra dependencies
  • default — Production-ready structure with Home-Manager, VM testing, dendritic flake-file
  • example — Namespaces, angle brackets, cross-platform (NixOS + Darwin), providers
  • noflake — Using Den with npins instead of flakes
  • microvm — Demostrates Den extensibility showcasing MicroVM virtualization.
  • nvf-standalone — Demostrates Den outside the NixOS/nix-Darwin framework.
  • flake-parts-modules — Integrate Den aspects with third-party flake-parts perSystem submodules.
  • fleet-demo — Multi-host fleet with environments, cross-host pipe.collect, haproxy load balancing
  • terranix-demo — Generate Terraform config from den hosts using policy.instantiate
  • bogus — Creating minimal reproductions for bug reports with nix-unit
  • ci — Comprehensive tests covering every Den feature (your best learning resource)

Start with the Minimal template to understand Den’s core, then graduate to Default for a real setup.

Contribute Community Sponsor