nix/modules/cluster/default.nix in confctl-1.0.0 vs nix/modules/cluster/default.nix in confctl-2.0.0
- old
+ new
@@ -44,11 +44,11 @@
};
};
addresses = mkOption {
type = types.nullOr (types.submodule addresses);
- default = null;
+ default = {};
description = ''
IP addresses
'';
};
@@ -61,10 +61,33 @@
List of MAC addresses for iPXE node auto-detection
'';
};
};
+ buildAttribute = mkOption {
+ type = types.listOf types.str;
+ default = [ "system" "build" "toplevel" ];
+ description = ''
+ Path to the attribute in machine system config that should be built
+
+ For example, `[ "system" "build" "toplevel" ]` will select attribute
+ `config.system.build.toplevel`.
+ '';
+ };
+
+ carrier = {
+ enable = mkEnableOption "This machine is a carrier for other machines";
+
+ machines = mkOption {
+ type = types.listOf (types.submodule carriedMachine);
+ default = [];
+ description = ''
+ List of carried machines
+ '';
+ };
+ };
+
host = mkOption {
type = types.nullOr (types.submodule host);
default = null;
};
@@ -319,25 +342,141 @@
default = null;
description = ''
Host FQDN
'';
apply = v:
- if isNull v && !isNull config.name && !isNull config.domain then
+ if isNull v && !isNull config.name then
concatStringsSep "." (
[ config.name ]
++ (optional (!isNull config.location) config.location)
- ++ [ config.domain ]
+ ++ (optional (!isNull config.domain) config.domain)
)
else
v;
};
target = mkOption {
type = types.nullOr types.str;
default = config.fqdn;
description = ''
Address/host to which the configuration is deployed to
+
+ Set to null if the machine is not deployable, e.g. when it is only used
+ as a carried machine.
'';
+ };
+ };
+ };
+
+ carriedMachine =
+ { config, ... }:
+ {
+ options = {
+ machine = mkOption {
+ type = types.str;
+ description = "Machine name";
+ };
+
+ alias = mkOption {
+ type = types.nullOr types.str;
+ description = "Alias for carried machine name";
+ };
+
+ labels = mkOption {
+ type = types.attrs;
+ default = {};
+ description = ''
+ Optional user-defined labels to classify the machine
+ '';
+ };
+
+ tags = mkOption {
+ type = types.listOf types.str;
+ default = [];
+ description = ''
+ Optional user-defined tags to classify the machine
+ '';
+ };
+
+ extraModules = mkOption {
+ type = types.listOf types.path;
+ default = [];
+ description = ''
+ A list of additional NixOS modules to be imported for this machine
+ '';
+ };
+
+ buildAttribute = mkOption {
+ type = types.listOf types.str;
+ default = [ "system" "build" "toplevel" ];
+ description = ''
+ Path to the attribute in machine system config that should be built
+
+ For example, `[ "system" "build" "toplevel" ]` will select attribute
+ `config.system.build.toplevel`.
+ '';
+ };
+
+ buildGenerations = {
+ min = mkOption {
+ type = types.nullOr types.int;
+ default = null;
+ description = ''
+ The minimum number of build generations to be kept on the build
+ machine.
+ '';
+ };
+
+ max = mkOption {
+ type = types.nullOr types.int;
+ default = null;
+ description = ''
+ The maximum number of build generations to be kept on the build
+ machine.
+ '';
+ };
+
+ maxAge = mkOption {
+ type = types.nullOr types.int;
+ default = null;
+ description = ''
+ Delete build generations older than
+ <option>cluster.<name>.carrier.machines.*.buildGenerations.maxAge</option>
+ seconds from the build machine. Old generations are deleted even
+ if <option>cluster.<name>.carrier.machines.*.buildGenerations.max</option> is
+ not reached.
+ '';
+ };
+ };
+
+ hostGenerations = {
+ min = mkOption {
+ type = types.nullOr types.int;
+ default = null;
+ description = ''
+ The minimum number of generations to be kept on the machine.
+ '';
+ };
+
+ max = mkOption {
+ type = types.nullOr types.int;
+ default = null;
+ description = ''
+ The maximum number of generations to be kept on the machine.
+ '';
+ };
+
+ maxAge = mkOption {
+ type = types.nullOr types.int;
+ default = null;
+ description = ''
+ Delete generations older than
+ <option>cluster.<name>.carrier.machines.*.hostGenerations.maxAge</option>
+ seconds from the machine. Old generations are deleted even
+ if <option>cluster.<name>.carrier.machines.*.hostGenerations.max</option> is
+ not reached.
+ '';
+ };
};
};
};
systemdProperty =