This provides an overview of the available options of the inventory model.
It can be set via the inventory attribute of the clan function, or via the clan.inventory attribute of flake-parts.
Attribute: inventory.instances
Multi host service module instances
Type: attribute set of (submodule)
Default:
{ } Declared in: modules/inventoryClass/inventory.nix
Attribute: inventory.instances.<name>.module
This option has no description.
Type: submodule
Default:
{ } Declared in: modules/inventoryClass/inventory.nix
Attribute: inventory.instances.<name>.module.input
Name of the input. Default to 'null' which means the module is local
Type: null or string
Default:
"Name of the input. Default to 'null' which means the module is local" Declared in: modules/inventoryClass/inventory.nix
Attribute: inventory.instances.<name>.module.name
Attribute of the clan service module imported from the chosen input.
Defaults to the name of the instance.
Type: string
Default:
"<Name of the Instance>" Declared in: modules/inventoryClass/inventory.nix
Attribute: inventory.instances.<name>.roles
This option has no description.
Type: attribute set of (submodule)
Default:
{ } Declared in: modules/inventoryClass/inventory.nix
Attribute: inventory.instances.<name>.roles.<name>.extraModules
List of additionally imported .nix expressions.
The import only happens if the machine is part of the service or role.
Other types are passed through to the nixos configuration.
To import the special.nix file
. Clan Directory
βββ flake.nix
...
βββ modules
βββ special.nix
βββ ... {
extraModules = [ "modules/special.nix" ];
}Type: list of raw value
Default:
[ ] Declared in: modules/inventoryClass/inventory.nix
Attribute: inventory.instances.<name>.roles.<name>.machines
This option has no description.
Type: attribute set of (submodule)
Default:
{ } Declared in: modules/inventoryClass/inventory.nix
Attribute: inventory.instances.<name>.roles.<name>.machines.<name>.settings
This option has no description.
Type: deferred custom module. Must be JSON serializable.
Default:
{ } Declared in: modules/inventoryClass/inventory.nix
Attribute: inventory.instances.<name>.roles.<name>.settings
This option has no description.
Type: deferred custom module. Must be JSON serializable.
Default:
{ } Declared in: modules/inventoryClass/inventory.nix
Attribute: inventory.instances.<name>.roles.<name>.tags
This option has no description.
Type: (attribute set of (submodule)) or (list of string) convertible to it
Default:
{ } Declared in: modules/inventoryClass/inventory.nix
Attribute: inventory.machines
Machines in the inventory.
Each machine declared here can be referencd via its attributeName by the inventory.services roles.
Type: lazy attribute set of (submodule)
Default:
{ } Declared in: modules/inventoryClass/inventory.nix
Attribute: inventory.machines.<name>.deploy
Attribute: inventory.machines.<name>.deploy.buildHost
SSH address of the host to build the machine on
Type: null or string
Default:
null Declared in: modules/inventoryClass/inventory.nix
Attribute: inventory.machines.<name>.deploy.targetHost
SSH address of the host to deploy the machine to
Type: null or string
Default:
null Declared in: modules/inventoryClass/inventory.nix
Attribute: inventory.machines.<name>.description
Optional freeform description
Type: null or string
Default:
null Declared in: modules/inventoryClass/inventory.nix
Attribute: inventory.machines.<name>.icon
Under construction, will be used for the UI
Type: null or string
Default:
null Declared in: modules/inventoryClass/inventory.nix
Attribute: inventory.machines.<name>.installedAt
Indicates when the machine was first installed.
Timestamp is in unix time (seconds since epoch).
Type: null or signed integer
Default:
null Declared in: modules/inventoryClass/inventory.nix
Attribute: inventory.machines.<name>.machineClass
The module system that should be used to construct the machine
Set this to darwin for macOS machines
Type: one of "nixos", "darwin"
Default:
"nixos" Declared in: modules/inventoryClass/inventory.nix
Attribute: inventory.machines.<name>.name
Name of the machine or service
Type: string
Default:
"βΉnameβΊ" Declared in: modules/inventoryClass/inventory.nix
Attribute: inventory.machines.<name>.tags
List of tags for the machine.
The machine can be referenced by its tags in inventory.services
inventory.machines.machineA.tags = [ "tag1" "tag2" ]; services.borgbackup."instance_1".roles.client.tags = [ "tag1" ];Tags can be used to determine the membership of the machine in the services. Without changing the service configuration, the machine can be added to a service by adding the correct tags to the machine.
Type: list of string
Default:
[ ] Declared in: modules/inventoryClass/inventory.nix
Attribute: inventory.meta
This option has no description.
Type: submodule
Declared in: modules/inventoryClass/inventory.nix
Attribute: inventory.meta.description
Optional freeform description
Type: null or string
Default:
null Declared in: modules/inventoryClass/meta.nix
Attribute: inventory.meta.domain
Domain for the clan.
It will be used to wire clan-internal services and resolve the address
for each machine of the clan using <hostname>.<meta.domain>
This can either be:
A top level domain (TLD). Set this to a valid, but not already existing TLD if you're using a mesh network between your machines. This will route requests between your machines over the mesh network.
A regular domain. Set this to a valid domain you own if you want
to route requests between your machines over the public internet.
You will have to manually setup your public DNS of that domain to
route <hostname>.<meta.domain> to each of your machines.
Type: string matching the pattern ^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?(.[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$
Default:
"clan" "clan.lol"Declared in: modules/inventoryClass/meta.nix
Attribute: inventory.meta.icon
Under construction, will be used for the UI
Type: null or string
Default:
null Declared in: modules/inventoryClass/meta.nix
Attribute: inventory.meta.name
Name of the clan.
Needs to be (globally) unique, as this determines the folder name where the flake gets downloaded to.
Should only contain alphanumeric characters, _ and -.
Type: string matching the pattern [a-zA-Z0-9_-]*
"my_clan"Declared in: modules/inventoryClass/meta.nix
Attribute: inventory.meta.tld
Deprecated: Use domain instead.
Type: null or string matching the pattern [a-z]+
Default:
null "ccc"Declared in: modules/inventoryClass/meta.nix
Attribute: inventory.modules
A mapping of module names to their path.
Each module can be referenced by its attributeName in the inventory.services attribute set.
Each module MUST fulfill the following requirements to be usable with the inventory:
README.md file with a description.features = [ "inventory" ] in the frontmatter section.roles with at least one {roleName}.nix file.For further information see: Module Authoring Guide.
clan-core.lib.clan {
# 1. Add the module to the available inventory modules
inventory.modules = {
custom-module = ./modules/my_module;
};
# 2. Use the module in the inventory
inventory.services = {
custom-module.instance_1 = {
roles.default.machines = [ "machineA" ];
};
};
};Type: attribute set of raw value
Default:
"clanModules of clan-core" Declared in: modules/inventoryClass/inventory.nix
Attribute: inventory.tags
Tags of the inventory are used to group machines together.
It is recommended to use machine.tags to define the tags of the machines.
This can be used to define custom tags that are either statically set or dynamically computed.
inventory.tags = {
foo = [ "machineA" "machineB" ];
}; The tag foo will always be added to machineA and machineB.
It is possible to compute tags based on the machines properties or based on other tags.
This is a powerful feature and should be used with caution.
It is possible to cause infinite recursion by computing tags based on the machines properties or based on other tags.
allButFoo is a computed tag. It will be added to all machines except 'foo'
all is a predefined tag. See the docs of tags.all.
# inventory.tags β β inventory.machines
inventory.tags = {config, machines...}: {
# βββ The "all" tag
allButFoo = builtins.filter (name: name != "foo") config.all;
};Do NOT compute tags from machine.tags this will cause infinite recursion.
Type: open submodule of lazy attribute set of list of string
Default:
{ } Declared in: modules/inventoryClass/inventory.nix
Attribute: inventory.tags.all
Will be added to all machines
inventory.machines.machineA.tags = [ "all" ];Type: list of string
Default:
"[ <All Machines> ]" Declared in: modules/inventoryClass/inventory.nix
Attribute: inventory.tags.darwin
Will be added to all machines that set machineClass = "darwin"
inventory.machines.machineA.tags = [ "darwin" ];Type: list of string
Default:
"[ <All Darwin Machines> ]" Declared in: modules/inventoryClass/inventory.nix
Attribute: inventory.tags.nixos
Will be added to all machines that set machineClass = "nixos"
inventory.machines.machineA.tags = [ "nixos" ];Type: list of string
Default:
"[ <All NixOS Machines> ]" Declared in: modules/inventoryClass/inventory.nix