Skip to content

Adding Machines

Clan has two general methods of adding machines:

  • Automatic: Detects every folder in the machines folder.
  • Declarative: Explicit declarations in Nix.

Automatic registration

Every folder machines/{machineName} will be registered automatically as a Clan machine.

Automatically loaded files

The following files are loaded automatically for each Clan machine:

  • machines/{machineName}/configuration.nix
  • machines/{machineName}/hardware-configuration.nix
  • machines/{machineName}/facter.json Automatically configured, for further information see nixos-facter
  • machines/{machineName}/disko.nix Automatically loaded, for further information see the disko docs.

Manual declaration

Machines can also be added manually under buildClan, clan.* in flake-parts or via inventory.

Note

It is possible to use inventory and buildClan together at the same time.

buildClan {
    machines = {
        "jon" = {
            # Any valid nixos config
        };
    };
}
buildClan {
    inventory = {
        machines = {
            "jon" = {
                # Inventory machines can set tags
                tags = [ "zone1" ];
            };
        };
    };
}