feat: generalize SSH key config

This commit is contained in:
2026-04-26 19:40:29 +02:00
parent 0318dd0cf6
commit 52ea09563f
6 changed files with 34 additions and 48 deletions
+18 -36
View File
@@ -25,6 +25,22 @@ let
}
);
sshKeyType = lib.types.submodule (
{ name, ... }:
{
options = {
publicKey = lib.mkOption {
type = lib.types.str;
};
privateKeyPath = lib.mkOption {
type = lib.types.str;
default = "~/.ssh/id_${name}";
};
};
}
);
accountType = lib.types.submodule (
{ config, ... }:
{
@@ -107,40 +123,6 @@ let
}
);
sourceControlMachineKeyType = lib.types.submodule (
{ name, ... }:
{
options = {
publicKey = lib.mkOption {
type = lib.types.nullOr lib.types.str;
default = null;
};
privateKeyPath = lib.mkOption {
type = lib.types.str;
default = "~/.ssh/id_${name}";
};
};
}
);
sourceControlMachineType = lib.types.submodule (
{ ... }:
{
options = {
personal = lib.mkOption {
type = lib.types.nullOr sourceControlMachineKeyType;
default = null;
};
work = lib.mkOption {
type = lib.types.nullOr sourceControlMachineKeyType;
default = null;
};
};
}
);
machineType = lib.types.submodule (
{ name, config, ... }:
{
@@ -164,8 +146,8 @@ let
default = { };
};
sourceControl = lib.mkOption {
type = sourceControlMachineType;
sshKeys = lib.mkOption {
type = lib.types.attrsOf sshKeyType;
default = { };
};