Getting Started
Prerequisites
Section titled “Prerequisites”- Nix with flakes enabled (or use without flakes)
- Basic familiarity with Nix modules
Quick Start — Launch the Demo VM
Section titled “Quick Start — Launch the Demo VM”Try Den instantly without installing anything:
nix run github:vic/denInitialize a New Project
Section titled “Initialize a New Project”Create a fresh Den-based flake:
mkdir my-infra && cd my-infranix flake init -t github:vic/dennix flake update denThis creates a project with:
flake.nix # inputs and entry pointmodules/ # your Den modules go here hosts.nix # host and user declarations aspects/ # aspect definitionsYour flake.nix
Section titled “Your flake.nix”The generated flake.nix imports Den and uses import-tree to load all modules:
{ outputs = inputs: inputs.flake-parts.lib.mkFlake { inherit inputs; } (inputs.import-tree ./modules);
inputs = { den.url = "github:vic/den"; flake-aspects.url = "github:vic/flake-aspects"; import-tree.url = "github:vic/import-tree"; nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; flake-parts.url = "github:hercules-ci/flake-parts"; };}Declare a Host
Section titled “Declare a Host”In modules/hosts.nix, declare your first host:
{ den.hosts.x86_64-linux.my-laptop.users.vic = { };}This single line creates:
- A NixOS host named
my-laptoponx86_64-linux - A user
vicwith Home-Manager support - Aspects
den.aspects.my-laptopandden.aspects.vic
Build It
Section titled “Build It”nixos-rebuild switch --flake .#my-laptopAvailable Templates
Section titled “Available Templates”| Template | Description |
|---|---|
default | Batteries-included layout |
minimal | Minimalistic Den flake |
noflake | No flakes, no flake-parts |
example | Examples and patterns |
ci | Feature test suite |
bogus | Bug reproduction |
nix flake init -t github:vic/den#minimalNext Steps
Section titled “Next Steps”- Your First Aspect — write cross-class configs
- Context-Aware Configs — make aspects react to context