blob: 11b96211c34e5af9ca747e2aaff4f4cc96ff4313 (
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
45
46
47
48
49
50
51
|
{ lib, config, pkgs, ... }:
with lib; let
cfg = config.local.net;
in
{
options.local.net = with lib.types; {
enable = mkEnableOption "networking stack";
hostname = mkOption {
type = str;
};
dhcpInterface = mkOption {
type = nullOr str;
default = null;
};
};
config = mkIf cfg.enable {
environment.systemPackages = [ pkgs.dhcpcd ];
networking = {
domain = mkDefault config.local.domains.host.main;
hostName = cfg.hostname;
firewall.logRefusedConnections = false;
useDHCP = false;
enableIPv6 = true;
useNetworkd = true;
useHostResolvConf = false;
wireguard.enable = true;
};
systemd.network.networks = mkIf (cfg.dhcpInterface != null) {
"40-${cfg.dhcpInterface}" = {
matchConfig.Name = cfg.dhcpInterface;
networkConfig = {
DHCP = "ipv4";
IPv6AcceptRA = true;
IPv6PrivacyExtensions = "kernel";
};
# make routing on this interface a dependency for network-online.target
linkConfig.RequiredForOnline = "routable";
};
};
};
}
|