split network configuration from default.nix

This commit is contained in:
Casper V. Kristensen 2024-02-24 16:43:10 +01:00
parent 84af935331
commit cad10a31eb
4 changed files with 33 additions and 27 deletions

View file

@ -4,21 +4,10 @@
../../modules/base ../../modules/base
../../modules/server ../../modules/server
./hardware.nix ./hardware.nix
./network.nix
]; ];
networking.hostName = "alpha"; networking.hostName = "alpha";
systemd.network.networks = {
"10-lan" = {
name = "enp1s0";
networkConfig.DHCP = "ipv4";
address = [
"2a01:4f8:c2c:71c0::/64"
];
routes = [
{ routeConfig = { Gateway = "fe80::1"; }; }
];
};
};
boot = { boot = {
loader = { loader = {

14
hosts/alpha/network.nix Normal file
View file

@ -0,0 +1,14 @@
{ ... }: {
systemd.network.networks = {
"10-lan" = {
name = "enp1s0";
networkConfig.DHCP = "ipv4";
address = [
"2a01:4f8:c2c:71c0::/64"
];
routes = [
{ routeConfig = { Gateway = "fe80::1"; }; }
];
};
};
}

View file

@ -5,25 +5,11 @@
../../modules/server ../../modules/server
../../modules/tor ../../modules/tor
./hardware.nix ./hardware.nix
./network.nix
./tor.nix ./tor.nix
]; ];
networking.hostName = "tor"; networking.hostName = "tor";
systemd.network.networks = {
"10-lan" = {
# IPv4 settings are from `sudo dhcpcd --test`.
# IPv6 settings are from https://www.ssdvps.dk/knowledgebase/18/IPv6-Gateway.html.
name = "ens3";
address = [
"91.210.59.57/25"
"2a0d:3e83:1:b284::1/64"
];
routes = [
{ routeConfig = { Gateway = "91.210.59.1"; }; }
{ routeConfig = { Gateway = "2a0d:3e83:1::1"; GatewayOnLink = true; }; }
];
};
};
boot = { boot = {
loader = { loader = {

17
hosts/tor/network.nix Normal file
View file

@ -0,0 +1,17 @@
{ ... }: {
systemd.network.networks = {
"10-lan" = {
# IPv4 settings are from `sudo dhcpcd --test`.
# IPv6 settings are from https://www.ssdvps.dk/knowledgebase/18/IPv6-Gateway.html.
name = "ens3";
address = [
"91.210.59.57/25"
"2a0d:3e83:1:b284::1/64"
];
routes = [
{ routeConfig = { Gateway = "91.210.59.1"; }; }
{ routeConfig = { Gateway = "2a0d:3e83:1::1"; GatewayOnLink = true; }; }
];
};
};
}