Skip to content

Project architecture

The framework is organized in layers: each level serves the one above, from the base system up to host and user profiles.

The complete structure and abstraction layers are described in the project overview.

  • dnf/ : the framework : modules, Home Manager configuration, libraries.
  • usr/ : the local project (writable) : configuration, secrets, machines.
  • var/generated/ : generated files (do not edit by hand).
  • src/generator/ : generator sources (Rust).
  • doc/ : this documentation.

The ready-to-use modules are documented in the module reference, sorted by category (system, service, security, console, graphic, admin, user, mixin, home).

Each level builds upon the previous one: the base system serves the modules, which compose the profiles, which define hosts and users.

LayerWhereRole
Modulesdnf/modules/standard/Unit bricks (a service, a system setting).
Mixinsdnf/modules/mixin/Macro-modules : host profiles, profile complements.
Homednf/home/Home Manager 🡕 modules and profiles (users).
Librarydnf/lib/Shared helpers (dnfLib) : network, OIDC, firewall, security…
Generationsrc/generator/Transforms etc/config.yamlvar/generated/.

The framework (dnf/) is reusable and rarely changed; the project (usr/) overrides it without touching it.

  • usr/modules/ mirrors dnf/modules/: a file at the same path overrides or complements the framework module.
  • usr/home/ mirrors dnf/home/ for user profiles and modules.
  • usr/machines/<host>/ holds hardware (hardware-configuration.nix, disko.nix) and specific settings.
  • usr/secrets/ contains encrypted secrets (sops).

DNF modules receive, in addition to standard NixOS arguments, specific arguments via specialArgs (the generator and flake.nix provide them):

ArgumentContent
config, lib, pkgsStandard NixOS arguments.
dnfLibShared DNF helpers (see Modules).
dnfConfigGlobal configuration (network ports, default values).
hostThe current host: hostname, users, services, features, profile.
hostsThe list of all hosts on the network.
networkNetwork topology: zones, domain, services.
zoneThe current host’s zone.
workDirProject root (absolute paths).

Some values don’t belong in etc/config.yaml (manual): too technical, or provisioned by a tool. The pattern: a script writes a var/generated/<x>.nix file that the assembler dnf/lib/mk-configuration.nix merges into an injected argument.

Example: just configure-alert-bot writes var/generated/matrix.nix (alert bot identity + room IDs), merged into network.matrix.* via recursiveUpdate (the generated file wins). Modules read network.matrix without knowing where it comes from.