dns refactor
This commit is contained in:
1 parent
09e2e03423
commit
045702e909
19 files changed
+118
-385
No files matched your search
+1
-1
@@ -10,7 +10,7 @@ modules/
|
||||
├── lib.nix # makeNixOs / makeIso / makeHomeManagerUsers / makeDarwinModule / eachSystem
|
||||
│ # (registers the `tether` flake input's NixOS module → programs.tether.*)
|
||||
├── main.nix # Base module imported by every host: core/ + nixos/ + network-drives.nix
|
||||
│ # + skyg.internalNetworkingMap (global app registry)
|
||||
│ # + skyg.internalNetworkingMap (global app registry + appNetwork)
|
||||
├── internal-networking.nix # Renders skyg.internalNetworkingMap → router generalMappings
|
||||
├── skyg-utils.nix # makeHyperlinkScriptToConfigs (symlinks configs/ → ~/.config/;
|
||||
│ # backs up an existing real dir to <path>.backup.<timestamp>)
|
||||
|
||||
+3
-2
@@ -138,8 +138,8 @@ in
|
||||
inherit
|
||||
user
|
||||
rootDir
|
||||
hostName
|
||||
configsDir
|
||||
hostName
|
||||
systemStateVersion
|
||||
homeManagerVersion
|
||||
;
|
||||
@@ -165,8 +165,8 @@ in
|
||||
inherit
|
||||
user
|
||||
rootDir
|
||||
hostName
|
||||
configsDir
|
||||
hostName
|
||||
systemStateVersion
|
||||
homeManagerVersion
|
||||
;
|
||||
@@ -202,6 +202,7 @@ in
|
||||
inherit
|
||||
user
|
||||
rootDir
|
||||
configsDir
|
||||
homeManagerVersion
|
||||
hostName
|
||||
systemStateVersion;
|
||||
|
||||
+36
-8
@@ -54,11 +54,33 @@ in
|
||||
description = "Suffix appended to each app name to form its internal DNS name.";
|
||||
};
|
||||
|
||||
subnet = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.str;
|
||||
default = null;
|
||||
example = "10.0.101.0/24";
|
||||
description = "LAN subnet the apps live on (informational).";
|
||||
appNetwork = lib.mkOption {
|
||||
default = { };
|
||||
description = ''
|
||||
The lab network the apps live on. Consumed as the defaults for the
|
||||
ipvlan/macvlan container networks (skyg.nixos.common.containers.networks).
|
||||
'';
|
||||
type = lib.types.submodule {
|
||||
options = {
|
||||
subnet = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "10.0.0.0/16";
|
||||
description = "IPv4 subnet (--subnet).";
|
||||
};
|
||||
|
||||
gateway = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "10.0.0.1";
|
||||
description = "IPv4 gateway (--gateway).";
|
||||
};
|
||||
|
||||
ipRange = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.str;
|
||||
default = null;
|
||||
description = "IPv4 range for dynamic address allocation (--ip-range).";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
apps = lib.mkOption {
|
||||
@@ -76,11 +98,17 @@ in
|
||||
# Global internal app registry.
|
||||
skyg.internalNetworkingMap = {
|
||||
rootDns = ".app.internal";
|
||||
subnet = "10.0.101.0/24";
|
||||
appNetwork = {
|
||||
subnet = "10.0.0.0/16";
|
||||
gateway = "10.0.0.1";
|
||||
ipRange = "10.0.101.16/28";
|
||||
};
|
||||
apps = {
|
||||
audiobooks = { ip = "10.0.101.4"; };
|
||||
buzz = { ip = "10.0.101.3"; aliasDns = "buzz.home.sosnovsky.ca"; };
|
||||
drawdb = { ip = "10.0.101.2"; };
|
||||
buzz = { ip = "10.0.101.3"; aliasDns = "buzz.home.sosnovsky.ca"; };
|
||||
audiobooks = { ip = "10.0.101.4"; };
|
||||
# jellyfin = { ip = "10.0.101.5"; aliasDns = "jellyfin.home.sosnovsky.ca"; };
|
||||
nvr = { ip = "10.0.101.6"; aliasDns = "nvr.home.sosnovsky.ca"; };
|
||||
portainer = { ip = "10.0.101.241"; };
|
||||
};
|
||||
};
|
||||
|
||||
@@ -64,14 +64,12 @@ Two predefined lab networks are available:
|
||||
skyg.nixos.common.containers.networks.macvlanLab = {
|
||||
enable = true;
|
||||
parent = "eno1";
|
||||
ipRange = "10.0.101.16/28";
|
||||
};
|
||||
|
||||
# ipvlan L2 mode (host can reach its own containers — preferred)
|
||||
skyg.nixos.common.containers.networks.ipvlanLab = {
|
||||
enable = true;
|
||||
parent = "eno1";
|
||||
ipRange = "10.0.101.16/28";
|
||||
};
|
||||
```
|
||||
|
||||
@@ -93,8 +91,10 @@ skyg.nixos.common.containers.networks.extra.myNet = {
|
||||
};
|
||||
```
|
||||
|
||||
Predefined fields: `enable`, `parent`, `subnet` (default `10.0.0.0/16`), `gateway` (default
|
||||
`10.0.0.1`), `ipRange`, `internal`. Extra networks also have `name`, `driver`, `driverOpts`.
|
||||
Predefined fields: `enable`, `parent`, `subnet`, `gateway`, `ipRange`, `internal`. `subnet`,
|
||||
`gateway`, and `ipRange` default to `skyg.internalNetworkingMap.appNetwork` (see
|
||||
`modules/main.nix`), so the lab network is declared once. Extra networks also have `name`,
|
||||
`driver`, `driverOpts`.
|
||||
Works with both docker and podman.
|
||||
|
||||
## Container service groups (`skyg.nixos.common.container-services`)
|
||||
|
||||
@@ -70,19 +70,19 @@ in
|
||||
|
||||
subnet = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "10.0.0.0/16";
|
||||
default = config.skyg.internalNetworkingMap.appNetwork.subnet;
|
||||
description = "IPv4 subnet.";
|
||||
};
|
||||
|
||||
gateway = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "10.0.0.1";
|
||||
default = config.skyg.internalNetworkingMap.appNetwork.gateway;
|
||||
description = "IPv4 gateway.";
|
||||
};
|
||||
|
||||
ipRange = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.str;
|
||||
default = null;
|
||||
default = config.skyg.internalNetworkingMap.appNetwork.ipRange;
|
||||
description = "IPv4 range for dynamic address allocation (--ip-range).";
|
||||
};
|
||||
|
||||
@@ -124,19 +124,19 @@ in
|
||||
|
||||
subnet = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "10.0.0.0/16";
|
||||
default = config.skyg.internalNetworkingMap.appNetwork.subnet;
|
||||
description = "IPv4 subnet.";
|
||||
};
|
||||
|
||||
gateway = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "10.0.0.1";
|
||||
default = config.skyg.internalNetworkingMap.appNetwork.gateway;
|
||||
description = "IPv4 gateway.";
|
||||
};
|
||||
|
||||
ipRange = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.str;
|
||||
default = null;
|
||||
default = config.skyg.internalNetworkingMap.appNetwork.ipRange;
|
||||
description = "IPv4 range for dynamic address allocation (--ip-range).";
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user