Files
clan-core/docs/site/manual/adding-machines.md
2024-09-24 12:52:53 +02:00

1.3 KiB

Adding Machines

Clan has two general methods of adding machines

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

Automatic register

Every machine of the form machines/{machineName} will be registered automatically.

Automatically imported:

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

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.

=== "Individual Machine Configuration"

```{.nix}
buildClan {
    machines = {
        "jon" = {
            # Any valid nixos config
        };
    };
}
```

=== "Inventory Configuration"

```{.nix}
buildClan {
    inventory = {
        machines = {
            "jon" = {
                # Inventory machines can set tags
                tags = [ "zone1" ];
            };
        };
    };
}
```