convert network link/address to module-based-service

... and make bridge use it.

We also had to convert bridge back into a pair of services.
Downstreams want to depend on the bridge it self being configured
even if not necessarily all the members are up. e.g. don't want
to break ssh on lan if there's a misconfigured wlan device
This commit is contained in:
Daniel Barlow 2023-08-27 23:45:27 +01:00
parent 1580857fde
commit 31f0213b6f
9 changed files with 185 additions and 58 deletions

View file

@ -44,6 +44,7 @@ in rec {
imports = [
../modules/wlan.nix
../modules/standard.nix
../modules/network
../modules/ppp
../modules/dnsmasq
../modules/firewall
@ -78,16 +79,16 @@ in rec {
} // wirelessConfig;
};
services.int =
let iface = svc.bridge.build {
ifname = "int";
members = with config.hardware.networkInterfaces; [
wlan_24 lan wlan_5
];
};
in address iface {
family = "inet4"; address ="10.8.0.1"; prefixLength = 16;
};
services.int = svc.network.address.build {
interface = svc.bridge.primary.build { ifname = "int"; };# services.int;
family = "inet"; address ="10.8.0.1"; prefixLength = 16;
};
services.bridge = svc.bridge.members.build {
primary = services.int;
members = with config.hardware.networkInterfaces;
[ wlan_24 wlan_5 lan ];
};
services.ntp = svc.ntp.build {
pools = { "pool.ntp.org" = ["iburst"]; };
@ -204,8 +205,8 @@ in rec {
name = "default";
contents = with config.services; [
config.hardware.networkInterfaces.lo
config.hardware.networkInterfaces.lan
int
bridge
hostap
hostap5
ntp