blob: 2c7f580f698504cd094359bcd466f4b513f68300 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
{
# lib,
config,
...
}: let
cfg = config.collinux.system.network;
dhcp_enabled = cfg.static == null;
device =
if (cfg.wireless == null)
then "eth0"
else "wl*";
in {
networking.useNetworkd = true;
systemd.network = {
enable = true;
wait-online = {
enable = true;
ignoredInterfaces = ["docker0"];
anyInterface = true;
};
networks."11-default" =
if dhcp_enabled
then {
name = device;
networkConfig.DHCP = "yes";
# never accept dhcp dns
dhcpV4Config.UseDNS = "no";
dhcpV6Config.UseDNS = "no";
}
else {
name = device;
networkConfig = {
Address = cfg.static.ip;
Gateway = cfg.static.gateway;
DHCP = "no";
# DNS is managed by systemd-resolved (not specified here)
};
};
};
}
|