feat: move to single-user config

This commit is contained in:
2026-04-26 18:08:48 +02:00
parent 75ba00929e
commit dba24ce5f3
27 changed files with 160 additions and 300 deletions
+20 -63
View File
@@ -1,5 +1,7 @@
{ lib, ... }:
{ lib, config, ... }:
let
nixosModules = config.flake.modules.nixos;
sourceControlScopeType = lib.types.enum [
"personal"
"work"
@@ -46,12 +48,11 @@ let
);
accountType = lib.types.submodule (
{ name, config, ... }:
{ config, ... }:
{
options = {
name = lib.mkOption {
type = lib.types.str;
default = name;
};
realName = lib.mkOption {
@@ -73,16 +74,6 @@ let
default = { };
};
baseModule = lib.mkOption {
type = lib.types.deferredModule;
default = { };
};
workstationModule = lib.mkOption {
type = lib.types.deferredModule;
default = { };
};
sourceControl = lib.mkOption {
type = sourceControlAccountType;
default = { };
@@ -160,7 +151,7 @@ let
}
);
sourceControlMachineUserType = lib.types.submodule (
sourceControlMachineType = lib.types.submodule (
{ ... }:
{
options = {
@@ -177,27 +168,6 @@ let
}
);
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;
};
};
}
);
machineType = lib.types.submodule (
{ name, config, ... }:
{
@@ -209,11 +179,7 @@ let
module = lib.mkOption {
type = lib.types.deferredModule;
default = { };
};
buildFunction = lib.mkOption {
type = lib.types.functionTo lib.types.deferredModule;
default = nixosModules.${name};
};
stateVersion = lib.mkOption {
@@ -230,19 +196,28 @@ let
default = { };
};
users = lib.mkOption {
type = lib.types.attrsOf machineUserType;
sourceControl = lib.mkOption {
type = sourceControlMachineType;
default = { };
};
syncthingId = lib.mkOption {
type = lib.types.nullOr lib.types.str;
default = null;
};
portable = lib.mkOption {
type = lib.types.bool;
default = false;
};
};
}
);
in
{
options.repo = {
accounts = lib.mkOption {
type = lib.types.attrsOf accountType;
default = { };
account = lib.mkOption {
type = accountType;
};
machines = lib.mkOption {
@@ -250,11 +225,6 @@ in
default = { };
};
contact = lib.mkOption {
type = lib.types.raw;
default = { };
};
desktop = lib.mkOption {
type = lib.types.raw;
default = { };
@@ -279,17 +249,4 @@ in
};
};
config.flake.modules.homeManager.meta =
{ ... }:
{
options.meta = {
machine = lib.mkOption {
type = machineType;
};
user = lib.mkOption {
type = machineUserType;
};
};
};
}