Skip to content

Adding systems

The per-system configuration lives in /systems/<hostname>/. To wire a host into the flake it must be declared in nixosConfigurations (or darwinConfigurations) inside modules/flake/default.nix.

Each entry is passed through the mkHost helper at modules/flake/lib/mkhost.nix. It accepts the following options:

  • arch
    • default: "x86_64"
    • options: "x86_64", "aarch64"
  • class
    • default: "nixos"
    • options: "nixos", "darwin", "iso", "wsl"
  • modules
    • default: [ ]
    • extra NixOS / nix-darwin modules to import on top of the host’s systems/<hostname>/default.nix
  • specialArgs
    • default: { }
    • merged on top of the default specialArgs (which already includes inputs and self)

For example, an aarch64 NixOS server:

nixosConfigurations = mkHosts {
skadi = {
arch = "aarch64";
};
};

A macOS host:

darwinConfigurations = mkHosts {
tatsumaki = {
arch = "aarch64";
class = "darwin";
};
};

The system tuple (e.g. aarch64-linux, x86_64-linux, aarch64-darwin) is derived from arch and class, so you don’t need to set it yourself.