server: device-specific code cleanup

This commit is contained in:
chayleaf 2024-07-13 06:43:05 +07:00
parent c85b92b4cb
commit 5a3dda7a10
Signed by: chayleaf
GPG key ID: 78171AD46227E68E

View file

@ -35,7 +35,7 @@ in
"net.ipv4.tcp_congestion_control" = "bbr"; "net.ipv4.tcp_congestion_control" = "bbr";
}; };
# as expected, systemd initrd and networking didn't work well, and i really cba to debug it # as expected, systemd initrd didn't work well, and i really cba to debug it
networking.useDHCP = false; networking.useDHCP = false;
networking.useNetworkd = true; networking.useNetworkd = true;
systemd.network = { systemd.network = {
@ -50,46 +50,22 @@ in
networks."10-dhcp" = { networks."10-dhcp" = {
DHCP = "yes"; DHCP = "yes";
name = "e*"; name = "e*";
networkConfig = { networkConfig.IPv6AcceptRA = "yes";
IPv6AcceptRA = "yes";
};
dhcpV4Config = { dhcpV4Config = {
ClientIdentifier = "mac"; ClientIdentifier = "mac";
DUIDType = "link-layer"; DUIDType = "link-layer";
}; };
dhcpV6Config = { dhcpV6Config.DUIDType = "link-layer";
DUIDType = "link-layer";
};
}; };
}; };
boot.initrd = { boot.initrd = {
/*systemd = {
enable = true;
network = {
enable = true;
links."10-mac" = {
matchConfig.OriginalName = "e*";
linkConfig = {
MACAddressPolicy = "none";
MACAddress = router-config.router-settings.serverInitrdMac;
};
};
networks."10-dhcp" = {
DHCP = "yes";
name = "e*";
};
};
};*/
# eth0 on some kernels # eth0 on some kernels
# end0 on other kernels # end0 on other kernels
# sometimes even version dependent # sometimes even version dependent
preLVMCommands = lib.mkOrder 499 '' preLVMCommands = lib.mkOrder 499 ''
ip link set end0 address ${router-config.router-settings.serverInitrdMac} || ip link set eth0 address ${router-config.router-settings.serverInitrdMac} || true ip link set end0 address ${router-config.router-settings.serverInitrdMac} || ip link set eth0 address ${router-config.router-settings.serverInitrdMac} || true
''; '';
# postMountCommands = ''
# ip link set end0 address ${router-config.router-settings.serverMac} || ip link set eth0 address ${router-config.router-settings.serverMac} || true
# '';
network.enable = true; network.enable = true;
network.flushBeforeStage2 = true; network.flushBeforeStage2 = true;
network.udhcpc.enable = true; network.udhcpc.enable = true;
@ -102,7 +78,6 @@ in
"/secrets/initrd/ssh_host_rsa_key" "/secrets/initrd/ssh_host_rsa_key"
"/secrets/initrd/ssh_host_ed25519_key" "/secrets/initrd/ssh_host_ed25519_key"
]; ];
# shell = "/bin/cryptsetup-askpass";
}; };
luks.devices.cryptroot = { luks.devices.cryptroot = {
device = parts.enc; device = parts.enc;