summaryrefslogtreecommitdiff
path: root/hosts/vidhar/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'hosts/vidhar/default.nix')
-rw-r--r--hosts/vidhar/default.nix58
1 files changed, 48 insertions, 10 deletions
diff --git a/hosts/vidhar/default.nix b/hosts/vidhar/default.nix
index 405b5efa..933f5af9 100644
--- a/hosts/vidhar/default.nix
+++ b/hosts/vidhar/default.nix
@@ -72,7 +72,7 @@
72 useDHCP = false; 72 useDHCP = false;
73 useNetworkd = true; 73 useNetworkd = true;
74 74
75 interfaces."eno1" = { 75 interfaces."lan" = {
76 ipv4.addresses = [ 76 ipv4.addresses = [
77 { address = "10.141.0.1"; prefixLength = 24; } 77 { address = "10.141.0.1"; prefixLength = 24; }
78 ]; 78 ];
@@ -88,6 +88,10 @@
88 id = 2; 88 id = 2;
89 interface = "eno2"; 89 interface = "eno2";
90 }; 90 };
91 lan = {
92 id = 3;
93 interface = "eno2";
94 };
91 }; 95 };
92 96
93 firewall.enable = false; 97 firewall.enable = false;
@@ -103,7 +107,7 @@
103 107
104 services.dhcpd4 = { 108 services.dhcpd4 = {
105 enable = true; 109 enable = true;
106 interfaces = [ "eno1" "mgmt" ]; 110 interfaces = [ "lan" "mgmt" ];
107 extraConfig = '' 111 extraConfig = ''
108 subnet 10.141.0.0 netmask 255.255.255.0 { 112 subnet 10.141.0.0 netmask 255.255.255.0 {
109 range 10.141.0.128 10.141.0.254; 113 range 10.141.0.128 10.141.0.254;
@@ -138,7 +142,7 @@
138 monitor = true; 142 monitor = true;
139 verbose = true; 143 verbose = true;
140 } 144 }
141 { name = "eno1"; 145 { name = "lan";
142 advertise = true; 146 advertise = true;
143 verbose = true; 147 verbose = true;
144 prefix = [{ prefix = "::/64"; }]; 148 prefix = [{ prefix = "::/64"; }];
@@ -156,7 +160,7 @@
156 router = true; 160 router = true;
157 rules.lan = { 161 rules.lan = {
158 method = "iface"; 162 method = "iface";
159 interface = "eno1"; 163 interface = "lan";
160 network = "::/0"; 164 network = "::/0";
161 }; 165 };
162 }; 166 };
@@ -186,9 +190,9 @@
186 after = [ "sys-subsystem-net-devices-telekom.device" ]; 190 after = [ "sys-subsystem-net-devices-telekom.device" ];
187 }; 191 };
188 systemd.services."dhcpcd-telekom" = { 192 systemd.services."dhcpcd-telekom" = {
189 wantedBy = [ "multi-user.target" "network-online.target" ]; 193 wantedBy = [ "multi-user.target" "network-online.target" "pppd-telekom.service" ];
190 bindsTo = [ "pppd-telekom.service" ]; 194 bindsTo = [ "pppd-telekom.service" "sys-subsystem-net-devices-dsl.device" ];
191 after = [ "pppd-telekom.service" ]; 195 after = [ "pppd-telekom.service" "sys-subsystem-net-devices-dsl.device" ];
192 wants = [ "network.target" ]; 196 wants = [ "network.target" ];
193 before = [ "network-online.target" ]; 197 before = [ "network-online.target" ];
194 198
@@ -197,6 +201,18 @@
197 201
198 stopIfChanged = false; 202 stopIfChanged = false;
199 203
204 preStart = ''
205 i=0
206
207 while [[ -z "$(${pkgs.iproute2}/bin/ip -6 addr show dev ${config.networking.pppInterface} scope link)" ]]; do
208 ${pkgs.coreutils}/bin/sleep 0.1
209 i=$((i + 1))
210 if [[ "$i" -ge 10 ]]; then
211 exit 1
212 fi
213 done
214 '';
215
200 serviceConfig = let 216 serviceConfig = let
201 dhcpcdConf = pkgs.writeText "dhcpcd.conf" '' 217 dhcpcdConf = pkgs.writeText "dhcpcd.conf" ''
202 duid 218 duid
@@ -219,7 +235,7 @@
219 ipv6ra_autoconf 235 ipv6ra_autoconf
220 iaid 1195061668 236 iaid 1195061668
221 ipv6rs # enable routing solicitation for WAN adapter 237 ipv6rs # enable routing solicitation for WAN adapter
222 ia_pd 1 eno1/0/64/0 # request a PD and assign it to the LAN 238 ia_pd 1 lan/0/64/0 # request a PD and assign it to the LAN
223 239
224 waitip 6 240 waitip 6
225 ''; 241 '';
@@ -230,8 +246,30 @@
230 ExecStart = "@${pkgs.dhcpcd}/sbin/dhcpcd dhcpcd -q --config ${dhcpcdConf}"; 246 ExecStart = "@${pkgs.dhcpcd}/sbin/dhcpcd dhcpcd -q --config ${dhcpcdConf}";
231 ExecReload = "${pkgs.dhcpcd}/sbin/dhcpcd --rebind"; 247 ExecReload = "${pkgs.dhcpcd}/sbin/dhcpcd --rebind";
232 Restart = "always"; 248 Restart = "always";
249 RestartSec = "5";
250 };
251 };
252 systemd.services.ndppd = {
253 wantedBy = [ "dhcpcd-telekom.service" ];
254 bindsTo = [ "dhcpcd-telekom.service" ];
255 after = [ "dhcpcd-telekom.service" ];
256
257 serviceConfig = {
258 Restart = "always";
259 RestartSec = "5";
260 };
261 };
262 systemd.services.corerad = {
263 wantedBy = [ "dhcpcd-telekom.service" ];
264 bindsTo = [ "dhcpcd-telekom.service" ];
265 after = [ "dhcpcd-telekom.service" ];
266
267 serviceConfig = {
268 Restart = lib.mkForce "always";
269 RestartSec = "5";
233 }; 270 };
234 }; 271 };
272 systemd.services."systemd-networkd".stopIfChanged = false;
235 users.users.dhcpcd = { 273 users.users.dhcpcd = {
236 isSystemUser = true; 274 isSystemUser = true;
237 group = "dhcpcd"; 275 group = "dhcpcd";
@@ -349,7 +387,7 @@
349 disable spoolss = yes 387 disable spoolss = yes
350 guest account = nobody 388 guest account = nobody
351 bind interfaces only = yes 389 bind interfaces only = yes
352 interfaces = lo eno1 390 interfaces = lo lan
353 ''; 391 '';
354 shares = { 392 shares = {
355 homes = { 393 homes = {
@@ -379,7 +417,7 @@
379 services.samba-wsdd = { 417 services.samba-wsdd = {
380 enable = true; 418 enable = true;
381 workgroup = "WORKGROUP"; 419 workgroup = "WORKGROUP";
382 interface = [ "lo" "eno1" ]; 420 interface = [ "lo" "lan" ];
383 }; 421 };
384 422
385 fileSystems."/srv/eos.lower" = { 423 fileSystems."/srv/eos.lower" = {