This commit is contained in:
pinpox
2025-10-16 11:06:31 +02:00
parent 9851993b82
commit 9299cd9666
15 changed files with 40 additions and 4 deletions

View File

@@ -88,6 +88,7 @@ For the provide flake example, your flake should now look like this:
self = self; # this needs to point at the repository root self = self; # this needs to point at the repository root
specialArgs = {}; specialArgs = {};
meta.name = throw "Change me to something unique"; meta.name = throw "Change me to something unique";
meta.tld = throw "Change me to something unique";
machines = { machines = {
berlin = { berlin = {

View File

@@ -137,12 +137,13 @@ Description: None
This confirms your setup is working correctly. This confirms your setup is working correctly.
You can now change the default name by editing the `meta.name` field in your `clan.nix` file. You can now change the default name and tld by editing the `meta.name` and `meta.tld` fields in your `clan.nix` file.
```{.nix title="clan.nix" hl_lines="3"} ```{.nix title="clan.nix" hl_lines="3 4"}
{ {
# Ensure this is unique among all clans you want to use. # Ensure this is unique among all clans you want to use.
meta.name = "__CHANGE_ME__"; meta.name = "__CHANGE_ME__";
meta.tld = "changeme";
# ... # ...
# elided # elided

View File

@@ -10,10 +10,11 @@ and how to define a remote builder for your machine closures.
Set the machines `targetHost` to the reachable IP address of the new machine. Set the machines `targetHost` to the reachable IP address of the new machine.
This eliminates the need to specify `--target-host` in CLI commands. This eliminates the need to specify `--target-host` in CLI commands.
```{.nix title="clan.nix" hl_lines="9"} ```{.nix title="clan.nix" hl_lines="10"}
{ {
# Ensure this is unique among all clans you want to use. # Ensure this is unique among all clans you want to use.
meta.name = "my-clan"; meta.name = "my-clan";
meta.tld = "ccc";
inventory.machines = { inventory.machines = {
# Define machines here. # Define machines here.

View File

@@ -60,6 +60,7 @@ Configure Clan-wide settings and define machines. Here's an example `flake.nix`:
# Define your Clan # Define your Clan
clan = { clan = {
meta.name = ""; # Required and must be unique meta.name = ""; # Required and must be unique
meta.tld = ""; # Required and must be unique
machines = { machines = {
jon = { jon = {

View File

@@ -43,6 +43,7 @@ For the purpose of this guide we have two machines:
inherit self; inherit self;
meta.name = "myclan"; meta.name = "myclan";
meta.tld = "ccc";
inventory.machines = { inventory.machines = {
controller = {}; controller = {};

View File

@@ -63,6 +63,7 @@ To use `age` plugins with Clan, you need to configure them in your `flake.nix` f
inherit self; inherit self;
meta.name = "myclan"; meta.name = "myclan";
meta.tld = "ccc";
# Add YubiKey and FIDO2 HMAC plugins # Add YubiKey and FIDO2 HMAC plugins
# Note: Plugins must be available in nixpkgs. # Note: Plugins must be available in nixpkgs.

View File

@@ -81,6 +81,7 @@ in
description = null; description = null;
icon = null; icon = null;
name = "test"; name = "test";
tld = "clan";
}; };
}; };

View File

@@ -31,6 +31,20 @@ let
Under construction, will be used for the UI Under construction, will be used for the UI
''; '';
}; };
tld = lib.mkOption {
type = types.strMatching "[a-z]+";
default = "clan";
example = "ccc";
description = ''
Top level domain (TLD) of the clan. It should be set to a valid, but
not already existing TLD.
It will be used to provide clan-internal services and resolve each host of the
clan with:
<hostname>.<tld>
'';
};
}; };
in in
{ {

View File

@@ -20,7 +20,7 @@
); );
clan.core.settings = { clan.core.settings = {
inherit (meta) name icon; inherit (meta) name icon tld;
inherit directory; inherit directory;
machine = { machine = {
inherit name; inherit name;

View File

@@ -106,6 +106,15 @@ in
# Set by the flake, so it's read-only in the machine # Set by the flake, so it's read-only in the machine
readOnly = true; readOnly = true;
}; };
tld = lib.mkOption {
default = "clan";
type = lib.types.str;
description = ''
the TLD for the clan
'';
# Set by the flake, so it's read-only in the machine
readOnly = true;
};
machine = mkOption { machine = mkOption {
description = '' description = ''
Settings of the machine. Settings of the machine.

View File

@@ -81,11 +81,13 @@ class InventoryMachine(TypedDict):
InventoryMetaNameType = str InventoryMetaNameType = str
InventoryMetaDescriptionType = str | None InventoryMetaDescriptionType = str | None
InventoryMetaIconType = str | None InventoryMetaIconType = str | None
InventoryMetaTldType = str
class InventoryMeta(TypedDict): class InventoryMeta(TypedDict):
name: str name: str
description: NotRequired[InventoryMetaDescriptionType] description: NotRequired[InventoryMetaDescriptionType]
icon: NotRequired[InventoryMetaIconType] icon: NotRequired[InventoryMetaIconType]
tld: NotRequired[InventoryMetaTldType]

View File

@@ -1,6 +1,7 @@
{ {
# Ensure this is unique among all clans you want to use. # Ensure this is unique among all clans you want to use.
meta.name = "__CHANGE_ME__"; meta.name = "__CHANGE_ME__";
meta.tld = "changeme";
inventory.machines = { inventory.machines = {
# Define machines here. # Define machines here.

View File

@@ -5,5 +5,6 @@
]; ];
clan = { clan = {
meta.name = "__CHANGE_ME__"; meta.name = "__CHANGE_ME__";
meta.tld = "changeme";
}; };
} }

View File

@@ -1,6 +1,7 @@
{ {
# Ensure this is unique among all clans you want to use. # Ensure this is unique among all clans you want to use.
meta.name = "__CHANGE_ME__"; meta.name = "__CHANGE_ME__";
meta.tld = "changeme";
inventory.machines = { inventory.machines = {
# Define machines here. # Define machines here.

View File

@@ -11,6 +11,7 @@
# Change this to your clan name # Change this to your clan name
# Setting a name is required # Setting a name is required
meta.name = inputs.nixpkgs.lib.mkDefault "__clan__"; meta.name = inputs.nixpkgs.lib.mkDefault "__clan__";
meta.tld = inputs.nixpkgs.lib.mkDefault "changeme";
}; };
in in
{ {