mirror of
https://github.com/oddlama/nix-config.git
synced 2025-10-10 23:00:39 +02:00
feat: remove old "freeform" globals and use new structured globals
This commit is contained in:
parent
4e717fab96
commit
a128dd5f40
35 changed files with 214 additions and 59 deletions
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
config,
|
||||
globals,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
|
@ -19,13 +20,13 @@ in {
|
|||
type = types.attrsOf (types.submodule (submod: {
|
||||
options = {
|
||||
name = mkOption {
|
||||
description = "The name of the storage box to backup to. The box must be defined in the global secrets. Defaults to the attribute name.";
|
||||
description = "The name of the storage box to backup to. The box must be defined in the globals. Defaults to the attribute name.";
|
||||
default = submod.config._module.args.name;
|
||||
type = types.str;
|
||||
};
|
||||
|
||||
subuser = mkOption {
|
||||
description = "The name of the storage box subuser as defined in the global secrets, mapping this user to a subuser id.";
|
||||
description = "The name of the storage box subuser as defined in the globals, mapping this user to a subuser id.";
|
||||
type = types.str;
|
||||
};
|
||||
|
||||
|
@ -45,7 +46,7 @@ in {
|
|||
(boxCfg: {
|
||||
"storage-box-${boxCfg.name}" = {
|
||||
hetznerStorageBox = let
|
||||
box = config.repo.secrets.global.hetzner.storageboxes.${boxCfg.name};
|
||||
box = globals.hetzner.storageboxes.${boxCfg.name};
|
||||
in {
|
||||
enable = true;
|
||||
inherit (box) mainUser;
|
||||
|
|
|
@ -21,6 +21,24 @@ in {
|
|||
default = {};
|
||||
type = types.submodule {
|
||||
options = {
|
||||
root = {
|
||||
hashedPassword = mkOption {
|
||||
type = types.str;
|
||||
description = "My root user's password hash.";
|
||||
};
|
||||
};
|
||||
|
||||
myuser = {
|
||||
name = mkOption {
|
||||
type = types.str;
|
||||
description = "My unix username.";
|
||||
};
|
||||
hashedPassword = mkOption {
|
||||
type = types.str;
|
||||
description = "My unix password hash.";
|
||||
};
|
||||
};
|
||||
|
||||
net = mkOption {
|
||||
type = types.attrsOf (types.submodule (netSubmod: {
|
||||
options = {
|
||||
|
@ -195,6 +213,97 @@ in {
|
|||
});
|
||||
};
|
||||
};
|
||||
|
||||
domains = {
|
||||
me = mkOption {
|
||||
type = types.str;
|
||||
description = "My main domain.";
|
||||
};
|
||||
|
||||
personal = mkOption {
|
||||
type = types.str;
|
||||
description = "My personal domain.";
|
||||
};
|
||||
|
||||
mail.all = mkOption {
|
||||
type = types.listOf types.str;
|
||||
description = "All domains to configure on the mail server.";
|
||||
};
|
||||
|
||||
mail.primary = mkOption {
|
||||
type = types.str;
|
||||
description = "The primary mail domain.";
|
||||
};
|
||||
};
|
||||
|
||||
macs = mkOption {
|
||||
default = {};
|
||||
type = types.attrsOf types.str;
|
||||
description = "Known MAC addresses for external devices.";
|
||||
};
|
||||
|
||||
hetzner.storageboxes = mkOption {
|
||||
default = {};
|
||||
description = "Storage box configurations.";
|
||||
type = types.attrsOf (types.submodule {
|
||||
options = {
|
||||
mainUser = mkOption {
|
||||
type = types.str;
|
||||
description = "Main username for the storagebox";
|
||||
};
|
||||
|
||||
users = mkOption {
|
||||
default = {};
|
||||
description = "Subuser configurations.";
|
||||
type = types.attrsOf (types.submodule {
|
||||
options = {
|
||||
subUid = mkOption {
|
||||
type = types.int;
|
||||
description = "The subuser id";
|
||||
};
|
||||
|
||||
path = mkOption {
|
||||
type = types.str;
|
||||
description = "The home path for this subuser (i.e. backup destination)";
|
||||
};
|
||||
};
|
||||
});
|
||||
};
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
# Mirror of the kanidm.persons option.
|
||||
kanidm.persons = mkOption {
|
||||
description = "Provisioning of kanidm persons";
|
||||
default = {};
|
||||
type = types.attrsOf (types.submodule {
|
||||
options = {
|
||||
displayName = mkOption {
|
||||
description = "Display name";
|
||||
type = types.str;
|
||||
};
|
||||
|
||||
legalName = mkOption {
|
||||
description = "Full legal name";
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
};
|
||||
|
||||
mailAddresses = mkOption {
|
||||
description = "Mail addresses. First given address is considered the primary address.";
|
||||
type = types.listOf types.str;
|
||||
default = [];
|
||||
};
|
||||
|
||||
groups = mkOption {
|
||||
description = "List of groups this person should belong to.";
|
||||
type = types.listOf types.str;
|
||||
default = [];
|
||||
};
|
||||
};
|
||||
});
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue