Skip to content

Commit

Permalink
networking: Convert to NetworkManager
Browse files Browse the repository at this point in the history
  • Loading branch information
TLATER committed Mar 4, 2024
1 parent 5192c1e commit c2bca82
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 93 deletions.
11 changes: 1 addition & 10 deletions nixos-config/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -86,17 +86,8 @@
};

networking = {
wireless = {
enable = true;

allowAuxiliaryImperativeNetworks = true;
userControlled = {
enable = true;
group = "network";
};
};
useDHCP = false;
useNetworkd = true;
networking.networkmanager.enable = true;
};

time.timeZone = "Europe/Amsterdam";
Expand Down
58 changes: 52 additions & 6 deletions nixos-config/networks/personal.nix
Original file line number Diff line number Diff line change
@@ -1,12 +1,58 @@
{config, ...}: {
networking.wireless = {
environmentFile = config.sops.secrets.wireless-env.path;
networking.networkmanager = {
ensureProfiles.environmentFiles = [config.sops.secrets.wireless-env.path];

ensureProfiles.profiles = {
bond = {
connection = {
id = "bond";
type = "bond";
interface-name = "bond0";
};

bond = {
miimon = 100;
mode = "active-backup";
primary_reselect = "always";
fail_over_mac = "active";
updelay = 200;
};

ipv4.method = "auto";
ipv6 = {
addr-gen-mode = "default";
method = "auto";
};
};

ethernet = {
connection = {
id = "ethernet";
type = "ethernet";

master = "bond0";
slave-type = "bond";
};
};

networks = {
mikan = {
hidden = true;
authProtocols = ["WPA-PSK"];
pskRaw = "@PSK_MIKAN@";
connection = {
id = "mikan";
type = "wifi";

master = "bond0";
slave-type = "bond";
};

wifi = {
mode = "infrastructure";
ssid = "mikan";
};

wifi-security = {
key-mgmt = "wpa-psk";
psk = "$PSK_MIKAN";
};
};
};
};
Expand Down
38 changes: 1 addition & 37 deletions nixos-config/ren/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -93,45 +93,9 @@
networking = {
hostName = "ren";
hostId = "0d418d09";
wireless.interfaces = ["wlp2s0"];
};

systemd.network = {
netdevs = {
"10-bond0" = {
netdevConfig = {
Name = "bond0";
Kind = "bond";
};

bondConfig = {
Mode = "active-backup";
PrimaryReselectPolicy = "always";
MIIMonitorSec = "100ms";
};
};
};

networks = {
"10-bond0" = {
matchConfig.Name = "bond0";
networkConfig.DHCP = "yes";
};

"40-enp3s0" = {
matchConfig.Name = "enp3s0";
networkConfig = {
Bond = "bond0";
PrimarySlave = true;
};
};

"40-wlp2s0" = {
matchConfig.Name = "wlp2s0";
networkConfig.Bond = "bond0";
};
};
};
networking.networkmanager.ensureProfiles.profiles.bond.bond.primary = "enp3s0";

theming.cursor.x-scaling = 2.0;

Expand Down
41 changes: 1 addition & 40 deletions nixos-config/yui/networking.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
networking = {
hostName = "yui";
wireless.interfaces = ["wlp6s0"];

firewall.allowedTCPPorts = [
# Allow minecraft for when I'm running a minecraft server
Expand All @@ -17,43 +16,5 @@
hosts."127.0.0.1" = ["modules-cdn.eac-prod.on.epicgames.com"];
};

systemd.network = {
netdevs = {
"10-bond0" = {
netdevConfig = {
Name = "bond0";
Kind = "bond";
};

bondConfig = {
Mode = "active-backup";
PrimaryReselectPolicy = "always";
MIIMonitorSec = "100ms";
};
};
};

networks = {
"10-bond0" = {
matchConfig.Name = "bond0";
networkConfig.DHCP = "yes";
linkConfig.RequiredForOnline = "yes";
};

"40-eno1" = {
matchConfig.Name = "eno1";
networkConfig = {
Bond = "bond0";
PrimarySlave = true;
};
linkConfig.RequiredForOnline = "no";
};

"40-wlp6s0" = {
matchConfig.Name = "wlp6s0";
networkConfig.Bond = "bond0";
linkConfig.RequiredForOnline = "no";
};
};
};
networking.networkmanager.ensureProfiles.profiles.bond.bond.primary = "eno1";
}

0 comments on commit c2bca82

Please sign in to comment.