feat: generalize SSH key config
This commit is contained in:
+18
-36
@@ -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 = { };
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user