blob: 0e0dfcf71414101b19275a81decc97e2457da9e0 (
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
|
{ config, lib, ... }:
with lib;
let
containerConfig = config.containers.printing.config;
in {
config = {
containers.printing = {
privateNetwork = true;
ephemeral = true;
autoStart = true;
hostAddress = "10.141.4.0";
hostAddress6 = "2a03:4000:52:ada:4::";
localAddress = "10.141.4.1";
localAddress6 = "2a03:4000:52:ada:4::1";
interfaces = [ "printer" ];
config = let
hostConfig = config;
in { ... }: {
config = {
services = {
kea = {
dhcp4 = {
enable = true;
settings = {
valid-lifetime = 4000;
rebind-timer = 2000;
renew-timer = 1000;
interfaces-config = {
interfaces = [ "printer" ];
};
lease-database = {
name = "/var/lib/kea/dhcp4.leases";
persist = true;
type = "memfile";
};
subnet4 = [
{ subnet = "10.141.3.0/24";
option-data = [
{ name = "domain-name-servers";
data = "10.141.4.0";
}
{ name = "ntp-servers";
data = "10.141.4.0";
}
{ name = "broadcast-address";
data = "10.141.3.255";
}
{ name = "routers";
data = "10.141.3.1";
}
{ name = "domain-name";
data = "yggdrasil";
}
{ name = "domain-search";
data = "printer.yggdrasil, yggdrasil";
}
];
pools = [ { pool = "10.141.3.128 - 10.141.3.254"; } ];
reservations = [
{ hostname = "printer";
hw-address = "30:cd:a7:b0:55:8d";
ip-address = "10.141.3.2";
}
];
}
];
};
};
};
printing = {
enable = true;
listenAddresses = [
"*:631"
];
allowFrom = [ "all" ];
extraConf = ''
ServerName printing
ServerAlias 10.141.4.1 2a03:4000:52:ada:4::1 printing.vidhar.yggdrasil printing.vidhar.lan.yggdrasil
'';
};
resolved.enable = false;
};
networking = {
firewall.enable = false;
nftables = {
enable = true;
rulesetFile = ./ruleset.nft;
};
useDHCP = false;
useNetworkd = true;
interfaces."printer" = {
ipv4.addresses = [
{ address = "10.141.3.1"; prefixLength = 24; }
];
};
};
environment.etc."resolv.conf".text = ''
nameserver ${hostConfig.containers.printing.hostAddress6}
'';
system.stateVersion = hostConfig.system.stateVersion;
};
};
};
networking = {
vlans.printer = {
id = 5;
interface = "eno2";
};
};
};
}
|