1
1
Fork 1
mirror of https://github.com/oddlama/nix-config.git synced 2025-10-11 07:10:39 +02:00

chore: format everything

This commit is contained in:
oddlama 2024-11-26 13:34:55 +01:00
parent deca311c68
commit 7ccd7856ee
No known key found for this signature in database
GPG key ID: 14EFE510775FE39A
162 changed files with 4750 additions and 3718 deletions

View file

@ -2,9 +2,9 @@
lib,
options,
...
}: let
inherit
(lib)
}:
let
inherit (lib)
mkOption
types
;
@ -15,10 +15,11 @@
description = "The network to which this endpoint is associated.";
};
};
in {
in
{
options = {
globals = mkOption {
default = {};
default = { };
type = types.submodule {
options = {
root = {
@ -40,91 +41,100 @@ in {
};
net = mkOption {
type = types.attrsOf (types.submodule (netSubmod: {
options = {
cidrv4 = mkOption {
type = types.nullOr types.net.cidrv4;
description = "The CIDRv4 of this network";
default = null;
type = types.attrsOf (
types.submodule (netSubmod: {
options = {
cidrv4 = mkOption {
type = types.nullOr types.net.cidrv4;
description = "The CIDRv4 of this network";
default = null;
};
cidrv6 = mkOption {
type = types.nullOr types.net.cidrv6;
description = "The CIDRv6 of this network";
default = null;
};
hosts = mkOption {
type = types.attrsOf (
types.submodule (hostSubmod: {
options = {
id = mkOption {
type = types.int;
description = "The id of this host in the network";
};
ipv4 = mkOption {
type = types.nullOr types.net.ipv4;
description = "The IPv4 of this host";
readOnly = true;
default =
if netSubmod.config.cidrv4 == null then
null
else
lib.net.cidr.host hostSubmod.config.id netSubmod.config.cidrv4;
};
ipv6 = mkOption {
type = types.nullOr types.net.ipv6;
description = "The IPv6 of this host";
readOnly = true;
default =
if netSubmod.config.cidrv6 == null then
null
else
lib.net.cidr.host hostSubmod.config.id netSubmod.config.cidrv6;
};
cidrv4 = mkOption {
type = types.nullOr types.str; # FIXME: this is not types.net.cidr because it would zero out the host part
description = "The IPv4 of this host including CIDR mask";
readOnly = true;
default =
if netSubmod.config.cidrv4 == null then
null
else
lib.net.cidr.hostCidr hostSubmod.config.id netSubmod.config.cidrv4;
};
cidrv6 = mkOption {
type = types.nullOr types.str; # FIXME: this is not types.net.cidr because it would zero out the host part
description = "The IPv6 of this host including CIDR mask";
readOnly = true;
default =
if netSubmod.config.cidrv6 == null then
null
else
lib.net.cidr.hostCidr hostSubmod.config.id netSubmod.config.cidrv6;
};
};
})
);
};
};
cidrv6 = mkOption {
type = types.nullOr types.net.cidrv6;
description = "The CIDRv6 of this network";
default = null;
};
hosts = mkOption {
type = types.attrsOf (types.submodule (hostSubmod: {
options = {
id = mkOption {
type = types.int;
description = "The id of this host in the network";
};
ipv4 = mkOption {
type = types.nullOr types.net.ipv4;
description = "The IPv4 of this host";
readOnly = true;
default =
if netSubmod.config.cidrv4 == null
then null
else lib.net.cidr.host hostSubmod.config.id netSubmod.config.cidrv4;
};
ipv6 = mkOption {
type = types.nullOr types.net.ipv6;
description = "The IPv6 of this host";
readOnly = true;
default =
if netSubmod.config.cidrv6 == null
then null
else lib.net.cidr.host hostSubmod.config.id netSubmod.config.cidrv6;
};
cidrv4 = mkOption {
type = types.nullOr types.str; # FIXME: this is not types.net.cidr because it would zero out the host part
description = "The IPv4 of this host including CIDR mask";
readOnly = true;
default =
if netSubmod.config.cidrv4 == null
then null
else lib.net.cidr.hostCidr hostSubmod.config.id netSubmod.config.cidrv4;
};
cidrv6 = mkOption {
type = types.nullOr types.str; # FIXME: this is not types.net.cidr because it would zero out the host part
description = "The IPv6 of this host including CIDR mask";
readOnly = true;
default =
if netSubmod.config.cidrv6 == null
then null
else lib.net.cidr.hostCidr hostSubmod.config.id netSubmod.config.cidrv6;
};
};
}));
};
};
}));
})
);
};
services = mkOption {
type = types.attrsOf (types.submodule {
options = {
domain = mkOption {
type = types.str;
description = "The domain under which this service can be reached";
type = types.attrsOf (
types.submodule {
options = {
domain = mkOption {
type = types.str;
description = "The domain under which this service can be reached";
};
};
};
});
}
);
};
monitoring = {
ping = mkOption {
type = types.attrsOf (types.submodule {
options =
defaultOptions
// {
type = types.attrsOf (
types.submodule {
options = defaultOptions // {
hostv4 = mkOption {
type = types.nullOr types.str;
description = "The IP/hostname to ping via ipv4.";
@ -137,14 +147,14 @@ in {
default = null;
};
};
});
}
);
};
http = mkOption {
type = types.attrsOf (types.submodule {
options =
defaultOptions
// {
type = types.attrsOf (
types.submodule {
options = defaultOptions // {
url = mkOption {
type = types.either (types.listOf types.str) types.str;
description = "The url to connect to.";
@ -168,14 +178,14 @@ in {
default = false;
};
};
});
}
);
};
dns = mkOption {
type = types.attrsOf (types.submodule {
options =
defaultOptions
// {
type = types.attrsOf (
types.submodule {
options = defaultOptions // {
server = mkOption {
type = types.str;
description = "The DNS server to query.";
@ -192,14 +202,14 @@ in {
default = "A";
};
};
});
}
);
};
tcp = mkOption {
type = types.attrsOf (types.submodule {
options =
defaultOptions
// {
type = types.attrsOf (
types.submodule {
options = defaultOptions // {
host = mkOption {
type = types.str;
description = "The IP/hostname to connect to.";
@ -210,22 +220,25 @@ in {
description = "The port to connect to.";
};
};
});
}
);
};
};
mail = {
domains = mkOption {
default = {};
default = { };
description = "All domains on which we receive mail.";
type = types.attrsOf (types.submodule {
options = {
public = mkOption {
type = types.bool;
description = "Whether the domain should be available for use by any user";
type = types.attrsOf (
types.submodule {
options = {
public = mkOption {
type = types.bool;
description = "Whether the domain should be available for use by any user";
};
};
};
});
}
);
};
primary = mkOption {
@ -247,72 +260,78 @@ in {
};
macs = mkOption {
default = {};
default = { };
type = types.attrsOf types.str;
description = "Known MAC addresses for external devices.";
};
hetzner.storageboxes = mkOption {
default = {};
default = { };
description = "Storage box configurations.";
type = types.attrsOf (types.submodule {
options = {
mainUser = mkOption {
type = types.str;
description = "Main username for the storagebox";
};
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";
};
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)";
};
};
});
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;
};
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;
};
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 = [];
};
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 = [];
groups = mkOption {
description = "List of groups this person should belong to.";
type = types.listOf types.str;
default = [ ];
};
};
};
});
}
);
};
};
};