nixos: add server conditionals to network manager configuration

ensure wifi mac address is static if host is a server
This commit is contained in:
ooks-io 2024-11-30 16:29:42 +11:00
parent 4f20813139
commit 9459f9e1f6
2 changed files with 83 additions and 4 deletions

View file

@ -1,5 +1,10 @@
{lib, ...}: let
{
lib,
config,
...
}: let
inherit (lib) mkForce mkDefault;
inherit (config.ooknet) host;
in {
networking = {
enableIPv6 = true;
@ -15,8 +20,13 @@ in {
dns = "systemd-resolved";
plugins = mkForce [];
wifi = {
macAddress = "random";
scanRandMacAddress = true;
# why does my server have wifi? not sure.
# ensure my mac addr is static so I can reserve an IP
macAddress =
if host.role == "server"
then "permanent"
else "random";
scanRandMacAddress = host.role != "server";
powersave = true;
};
unmanaged = ["interface-name:tailscale*"];
@ -30,5 +40,7 @@ in {
fallbackDns = ["8.8.8.8"]; # google dns
};
};
systemd.services.NetworkManager-wait-online.enable = false;
# sometimes causes issues with network manager service never actually starting
# requiring me to manually start the service. fine on a workstation, not on a server
systemd.services.NetworkManager-wait-online.enable = host.role != "server";
}