2024-03-17 18:48:49 +00:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
pkgs,
|
|
|
|
...
|
|
|
|
}:
|
|
|
|
{
|
2023-12-15 12:14:55 +00:00
|
|
|
# TODO: factor these out into a separate interface.nix.
|
|
|
|
# Also think about moving these options out of `system.clan`.
|
|
|
|
# Maybe we should not re-use the already polluted confg.system namespace
|
|
|
|
# and instead have a separate top-level namespace like `clanOutputs`, with
|
|
|
|
# well defined options marked as `internal = true;`.
|
|
|
|
options.system.clan = lib.mkOption {
|
|
|
|
type = lib.types.submodule {
|
|
|
|
options = {
|
|
|
|
deployment.data = lib.mkOption {
|
|
|
|
type = lib.types.attrs;
|
|
|
|
description = ''
|
|
|
|
the data to be written to the deployment.json file
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
deployment.file = lib.mkOption {
|
|
|
|
type = lib.types.path;
|
|
|
|
description = ''
|
|
|
|
the location of the deployment.json file
|
|
|
|
'';
|
|
|
|
};
|
2024-02-02 04:32:48 +00:00
|
|
|
deployment.buildHost = lib.mkOption {
|
2024-02-06 13:45:21 +00:00
|
|
|
type = lib.types.nullOr lib.types.str;
|
2023-12-15 12:14:55 +00:00
|
|
|
description = ''
|
2024-02-02 04:32:48 +00:00
|
|
|
the hostname of the build host where nixos-rebuild is run
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
deployment.targetHost = lib.mkOption {
|
2024-02-06 13:45:21 +00:00
|
|
|
type = lib.types.nullOr lib.types.str;
|
2024-02-02 04:32:48 +00:00
|
|
|
description = ''
|
|
|
|
the hostname of the target host to be deployed to
|
2023-12-15 12:14:55 +00:00
|
|
|
'';
|
|
|
|
};
|
2024-02-06 16:44:13 +00:00
|
|
|
deployment.requireExplicitUpdate = lib.mkOption {
|
|
|
|
type = lib.types.bool;
|
|
|
|
description = ''
|
|
|
|
if true, the deployment will not be updated automatically.
|
|
|
|
'';
|
|
|
|
default = false;
|
|
|
|
};
|
2023-12-15 12:14:55 +00:00
|
|
|
vm.create = lib.mkOption {
|
|
|
|
type = lib.types.path;
|
|
|
|
description = ''
|
|
|
|
json metadata about the vm
|
|
|
|
'';
|
|
|
|
};
|
2024-02-07 04:24:43 +00:00
|
|
|
iso = lib.mkOption {
|
|
|
|
type = lib.types.path;
|
|
|
|
description = ''
|
|
|
|
A generated iso of the machine for the flash command
|
|
|
|
'';
|
|
|
|
};
|
2023-12-15 12:14:55 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
description = ''
|
|
|
|
utility outputs for clan management of this machine
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
# optimization for faster secret generate/upload and machines update
|
|
|
|
config = {
|
|
|
|
system.clan.deployment.data = {
|
2024-04-09 16:04:26 +00:00
|
|
|
facts = {
|
|
|
|
inherit (config.clanCore.facts)
|
|
|
|
secretUploadDirectory
|
|
|
|
secretModule
|
|
|
|
publicModule
|
|
|
|
services
|
|
|
|
;
|
|
|
|
};
|
2024-02-02 04:32:48 +00:00
|
|
|
inherit (config.clan.networking) targetHost buildHost;
|
2024-02-06 16:44:13 +00:00
|
|
|
inherit (config.clan.deployment) requireExplicitUpdate;
|
2023-12-15 12:14:55 +00:00
|
|
|
};
|
2024-03-17 18:48:49 +00:00
|
|
|
system.clan.deployment.file = pkgs.writeText "deployment.json" (
|
|
|
|
builtins.toJSON config.system.clan.deployment.data
|
|
|
|
);
|
2024-02-02 04:32:48 +00:00
|
|
|
};
|
2023-12-15 12:14:55 +00:00
|
|
|
}
|