Skip to content

The generator

The generator (src/generator/, written in Rust) transforms the declarative configuration etc/config.yaml into Nix code consumed by the framework.

  • Input: etc/config.yaml → hosts, users, network, services.
  • Output: var/generated/hosts.nix, users.nix, network.nix.

These files are generated: never edit them by hand. To regenerate them after a configuration change:

Fenêtre de terminal
just generate

A single source of truth (etc/config.yaml) is transformed into deterministic Nix code, consumed by the framework via flake.nix.

Diagram

The generator exposes one command per target. just generate chains them all together; you can also invoke a single one.

CommandOutputContent
hostsvar/generated/hosts.nixHosts: profiles, services, colmena tags.
usersvar/generated/users.nixUsers: profiles, groups.
networkvar/generated/network.nixTopology: zones, DNS, VPN.
diskousr/machines/<hôte>/disko.nixPer-host partitioning.
doc*/ref/modules.mdxModule reference (documentation).
Fenêtre de terminal
just generate # regenerate everything (via the Justfile)
just codegen # regenerate only the module reference (doc)

The generator runs in two modes, chosen automatically:

  • Co-development (sources + cargo present) → cargo run: fast compilation loop while modifying the generator.
  • Release (no local checkout) → dnf-generator binary provided by the framework’s devShell (nix develop github:darkone-linux/...).