chore: rename network units

prevent clashing with the files proxmox creates,
but precede them alphabetically so they're ignored
This commit is contained in:
arcnmx 2024-04-14 14:43:13 -07:00
parent 0d062b92ee
commit 91918b8061
8 changed files with 21 additions and 10 deletions

View file

@ -108,6 +108,9 @@
gateway4 = mkMerge [
(mkIf (system.proxmox.node.name == "reisen" && config.bridge == "vmbr0" && config.address4 != null && config.address4 != "dhcp") (mkAlmostOptionDefault "10.1.1.1"))
];
networkd.name = mkIf config.local.enable (
mkDefault "_00-local"
);
networkd.networkSettings = {
name = mkAlmostOptionDefault config.name;
ipv6AcceptRAConfig = mkIf config.local.enable {
@ -155,6 +158,7 @@
macAddress = mkIf (system.proxmox.network.interfaces.net0.macAddress or null != null && hasPrefix "BC:24:11:" system.proxmox.network.interfaces.net0.macAddress) (mkAlmostOptionDefault (
replaceStrings [ "BC:24:11:" ] [ "BC:24:19:" ] system.proxmox.network.interfaces.net0.macAddress
));
networkd.name = mkDefault "_00-int";
networkd.networkSettings = {
domains = mkDefault [ ]; # int.${domain}?
linkConfig.RequiredForOnline = false;

View file

@ -61,7 +61,7 @@ in {
};
dynamic.interface = mkOption {
type = str;
default = "eth0";
default = config.systemd.network.networks._00-local.name or "eth0";
};
};
config = {

View file

@ -2,7 +2,7 @@
inherit (lib.modules) mkDefault;
in {
config = {
systemd.network.networks.eth9 = {config, ...}: {
systemd.network.networks._00-int = {config, ...}: {
networkConfig = {
IPv6SendRA = mkDefault true;
};

View file

@ -2,9 +2,10 @@
config,
pkgs,
lib,
gensokyo-zone,
...
}: let
inherit (inputs.self.lib.lib) domain;
inherit (gensokyo-zone.lib) domain;
inherit (lib.modules) mkForce;
inherit (lib.strings) escapeShellArgs;
kubeMasterIP = "10.1.1.173";

View file

@ -1,11 +1,13 @@
{
lib,
gensokyo-zone,
config,
options,
meta,
access,
...
}: let
inherit (gensokyo-zone.lib) mkAlmostOptionDefault;
inherit (lib.modules) mkIf mkBefore mkOrder;
enableDns = !config.services.dnsmasq.enable && config.networking.hostName != "utsuho";
in {
@ -18,11 +20,11 @@ in {
#services.resolved.enable = mkIf enableDns false;
systemd.services.avahi-daemon = mkIf (options ? proxmoxLXC && config.services.avahi.enable) {
serviceConfig.ExecStartPre = mkIf config.services.resolved.enable [
"+-${config.systemd.package}/bin/resolvectl mdns ${config.systemd.network.networks.eth0.name or "eth0"} yes"
"+-${config.systemd.package}/bin/resolvectl mdns ${config.systemd.network.networks._00-local.name or "eth0"} yes"
];
};
systemd.network.networks.eth0 = mkIf (! options ? proxmoxLXC) {
name = "eth0";
systemd.network.networks._00-local = mkIf (! options ? proxmoxLXC) {
name = mkAlmostOptionDefault "ens18";
linkConfig.Multicast = true;
networkConfig.MulticastDNS = true;
};

View file

@ -133,7 +133,7 @@ in {
services.samba-wsdd = {
enable = mkIf cfg.enable (mkDefault true);
interface = mkDefault config.systemd.network.networks.eth0.name;
interface = mkDefault config.systemd.network.networks._00-local.name;
};
sops.secrets = {

View file

@ -48,7 +48,7 @@ in {
'';
# https://tailscale.com/kb/1320/performance-best-practices#ethtool-configuration
exitNodeRouting = optionalString cfg.advertiseExitNode ''
netdev=$(${pkgs.iproute2}/bin/ip route show 0/0 | ${pkgs.coreutils}/bin/cut -f5 -d' ' || echo ${config.systemd.network.networks.eth0.name or "eth0"})
netdev=$(${pkgs.iproute2}/bin/ip route show 0/0 | ${pkgs.coreutils}/bin/cut -f5 -d' ' || echo ${config.systemd.network.networks._00-local.name or "eth0"})
${getExe pkgs.ethtool} -K "$netdev" rx-udp-gro-forwarding on rx-gro-list off || true
'';
advertiseExitNode = "--advertise-exit-node" + optionalString (!cfg.advertiseExitNode) "=false";

View file

@ -5,6 +5,7 @@
modulesPath,
...
}: let
inherit (lib.modules) mkIf;
inherit (lib.attrsets) genAttrs nameValuePair;
inherit (builtins) listToAttrs;
dexFiles = [
@ -44,7 +45,10 @@ in {
{device = "/dev/disk/by-uuid/b374e454-7af5-46fc-b949-24e38a2216d5";}
];
networking.interfaces.ens18.useDHCP = true;
networking.interfaces.ens18 = mkIf (!config.systemd.network.enable) {
# TODO: stop using dhcp
useDHCP = true;
};
sops.secrets = let
dexCommon = {
@ -75,7 +79,7 @@ in {
};
};
systemd.network.networks.ens18 = {
systemd.network.networks._00-local = {
name = "ens18";
matchConfig = {
MACAddress = "BC:24:11:49:FE:DC";