Skip to content

state-version 🔹

Automatically generate the state version of the nixos installation.

Categories

Uncategorized

This module generates the system.stateVersion of the nixos installation automatically.

Options: system.stateVersion

Migration: If you are already setting system.stateVersion, then import the module and then either let the automatic generation happen, or trigger the generation manually for the machine. The module will take the specified version, if one is already supplied through the config. To manually generate the version for a specified machine run:

clan vars generate [MACHINE]

If the setting was already set you can then remove system.stateVersion from your machine configuration. For new machines, just import the module.

Usage via Inventory

Roles

This module can be used via predefined roles

- `default`

Every role has its own configuration options. Which are each listed below.

For more information, see the inventory guide.

Example

For example the admin module adds the following options globally to all machines where it is used.

clan.admin.allowedkeys

This means there are two equivalent ways to set the allowedkeys option. Either via a nixos module or via the inventory interface. But it is recommended to keep together imports and config to preserve locality of the module configuration.

clan-core.lib.buildClan {
    inventory.services = {
        admin.me = {
            roles.default.machines = [ "jon" ];
            config.allowedkeys = [ "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQD..." ];
        };
    };
};
clan-core.lib.buildClan {
    machines = {
        jon = {
            clan.admin.allowedkeys = [ "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQD..." ];
            imports = [ clanModules.admin ];
        };
    };
};

Options of default role

The state-version default doesnt offer / require any options to be set.

Usage via Nix

This module can be also imported directly in your nixos configuration. Although it is recommended to use the inventory interface if available.

Some modules are considered 'low-level' or 'expert modules' and are not available via the inventory interface.

{config, lib, inputs, ...}: {
    imports = [ inputs.clan-core.clanModules.state-version ];
    # ...
}

** This module doesnt require any options to be set.**