refactor: further progress

This commit is contained in:
2026-04-25 00:19:20 +02:00
parent 55fbe82a42
commit 0500aab3cb
31 changed files with 680 additions and 398 deletions
+114 -20
View File
@@ -1,6 +1,10 @@
{ lib, ... }:
let
# Account types
sourceControlScopeType = lib.types.enum [
"personal"
"work"
];
emailProviderType = lib.types.enum [
"mxrouting"
"office365"
@@ -22,6 +26,21 @@ let
type = lib.mkOption {
type = emailProviderType;
};
scope = lib.mkOption {
type = lib.types.nullOr sourceControlScopeType;
default = null;
};
};
}
);
sourceControlAccountType = lib.types.submodule (
{ ... }:
{
options.projectScope = lib.mkOption {
type = sourceControlScopeType;
default = "personal";
};
}
);
@@ -33,7 +52,6 @@ let
name = lib.mkOption {
type = lib.types.str;
default = name;
readOnly = true;
};
realName = lib.mkOption {
@@ -55,11 +73,6 @@ let
default = { };
};
extraGroups = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [ ];
};
baseModule = lib.mkOption {
type = lib.types.deferredModule;
default = { };
@@ -70,9 +83,13 @@ let
default = { };
};
sourceControl = lib.mkOption {
type = sourceControlAccountType;
default = { };
};
primaryEmail = lib.mkOption {
type = lib.types.nullOr emailType;
readOnly = true;
description = "Derived primary email entry for this user.";
default =
let
@@ -84,7 +101,6 @@ let
}
);
# Machine types
displayType = lib.types.submodule (
{ ... }:
{
@@ -106,19 +122,77 @@ let
scale = lib.mkOption {
type = lib.types.nullOr lib.types.float;
default = 1.0;
default = null;
};
width = lib.mkOption {
type = lib.types.int;
type = lib.types.nullOr lib.types.int;
default = null;
};
height = lib.mkOption {
type = lib.types.int;
type = lib.types.nullOr lib.types.int;
default = null;
};
refresh = lib.mkOption {
type = lib.types.float;
type = lib.types.nullOr lib.types.float;
default = null;
};
};
}
);
sourceControlMachineKeyType = lib.types.submodule (
{ ... }:
{
options = {
publicKey = lib.mkOption {
type = lib.types.nullOr lib.types.str;
default = null;
};
privateKeyPath = lib.mkOption {
type = lib.types.nullOr lib.types.str;
default = null;
};
};
}
);
sourceControlMachineUserType = lib.types.submodule (
{ ... }:
{
options = {
personal = lib.mkOption {
type = lib.types.nullOr sourceControlMachineKeyType;
default = null;
};
work = lib.mkOption {
type = lib.types.nullOr sourceControlMachineKeyType;
default = null;
};
};
}
);
machineUserType = lib.types.submodule (
{ ... }:
{
options = {
account = lib.mkOption {
type = accountType;
};
sourceControl = lib.mkOption {
type = sourceControlMachineUserType;
default = { };
};
syncthingId = lib.mkOption {
type = lib.types.nullOr lib.types.str;
default = null;
};
};
}
@@ -131,7 +205,6 @@ let
name = lib.mkOption {
type = lib.types.str;
default = name;
readOnly = true;
};
module = lib.mkOption {
@@ -157,8 +230,8 @@ let
default = { };
};
accounts = lib.mkOption {
type = lib.types.attrsOf accountType;
users = lib.mkOption {
type = lib.types.attrsOf machineUserType;
default = { };
};
};
@@ -171,14 +244,35 @@ in
type = lib.types.attrsOf accountType;
default = { };
};
machines = lib.mkOption {
type = lib.types.attrsOf machineType;
default = { };
};
contact = lib.mkOption {
type = lib.types.raw;
default = { };
};
desktop = lib.mkOption {
type = lib.types.raw;
default = { };
};
services = lib.mkOption {
type = lib.types.raw;
default = { };
};
theme = lib.mkOption {
type = lib.types.raw;
default = { };
};
};
config.flake.modules.nixos.meta =
{ config, ... }:
{ ... }:
{
options.meta.machine = lib.mkOption {
type = machineType;
@@ -186,15 +280,15 @@ in
};
config.flake.modules.homeManager.meta =
{ config, ... }:
{ ... }:
{
options.meta = {
machine = lib.mkOption {
type = machineType;
};
account = lib.mkOption {
type = accountType;
user = lib.mkOption {
type = machineUserType;
};
};
};