rename deployment address to target address

This is a prepares having a build server for deployment
This commit is contained in:
Jörg Thalheim
2024-02-02 11:32:48 +07:00
parent 3183a3e2fc
commit 584299e199
16 changed files with 69 additions and 43 deletions

View File

@@ -1,7 +1,7 @@
{ config, lib, ... }:
{
options.clan.networking = {
deploymentAddress = lib.mkOption {
targetHost = lib.mkOption {
description = ''
The target SSH node for deployment.
@@ -14,10 +14,27 @@
- user@machine2.example.com
- root@example.com:2222&IdentityFile=/path/to/private/key
'';
type = lib.types.str;
};
buildHost = lib.mkOption {
description = ''
The build SSH node where nixos-rebuild will be executed.
If set to null, the targetHost will be used.
format: user@host:port&SSH_OPTION=SSH_VALUE
examples:
- machine.example.com
- user@machine2.example.com
- root@example.com:2222&IdentityFile=/path/to/private/key
'';
type = lib.types.nullOr lib.types.str;
default = "root@${config.networking.hostName}";
default = null;
};
};
imports = [
(lib.mkRenamedOptionModule [ "clan" "networking" "deploymentAddress" ] [ "clan" "networking" "buildHost" ])
];
config = {
# conflicts with systemd-resolved
networking.useHostResolvConf = false;

View File

@@ -19,10 +19,16 @@
the location of the deployment.json file
'';
};
deploymentAddress = lib.mkOption {
deployment.buildHost = lib.mkOption {
type = lib.types.str;
description = ''
the address of the deployment server
the hostname of the build host where nixos-rebuild is run
'';
};
deployment.targetHost = lib.mkOption {
type = lib.types.str;
description = ''
the hostname of the target host to be deployed to
'';
};
secretsUploadDirectory = lib.mkOption {
@@ -66,10 +72,10 @@
config = {
system.clan.deployment.data = {
inherit (config.system.clan) secretsModule secretsData;
inherit (config.clan.networking) deploymentAddress;
inherit (config.clan.networking) targetHost buildHost;
inherit (config.clanCore) secretsUploadDirectory;
};
system.clan.deployment.file = pkgs.writeText "deployment.json" (builtins.toJSON config.system.clan.deployment.data);
};
};
}