mirror of
https://github.com/oddlama/nix-config.git
synced 2025-10-10 23:00:39 +02:00
refactor: move lan ip information to globals
This commit is contained in:
parent
859e3d1771
commit
def57cfc61
18 changed files with 163 additions and 62 deletions
|
@ -14,12 +14,81 @@ in {
|
|||
default = {};
|
||||
type = types.submodule {
|
||||
options = {
|
||||
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;
|
||||
};
|
||||
|
||||
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.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.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.net.cidrv4;
|
||||
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.net.cidrv6;
|
||||
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 = "";
|
||||
description = "The domain under which this service can be reached";
|
||||
};
|
||||
};
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue