mirror of
https://github.com/foo-dogsquared/nixos-config.git
synced 2025-01-31 04:58:01 +00:00
hosts/ni: modularize networking configuration
Re-added the setup with the traditional networking configuration since I'm currently using GNOME which only integrates with NetworkManager which is working alongside it. systemd-networkd not being used at this point but I'm keeping it.
This commit is contained in:
parent
300aaa786b
commit
8a23bd7932
@ -1,7 +1,10 @@
|
||||
{ config, lib, pkgs, modulesPath, ... }:
|
||||
|
||||
{
|
||||
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
|
||||
imports = [
|
||||
(modulesPath + "/installer/scan/not-detected.nix")
|
||||
./modules/hardware/traditional-networking.nix
|
||||
];
|
||||
|
||||
boot.initrd.availableKernelModules =
|
||||
[ "xhci_pci" "ahci" "nvme" "usb_storage" "uas" "sd_mod" ];
|
||||
@ -25,54 +28,6 @@
|
||||
|
||||
swapDevices = [{ label = "swap"; }];
|
||||
|
||||
networking = {
|
||||
usePredictableInterfaceNames = true;
|
||||
useNetworkd = true;
|
||||
|
||||
# We're using networkd to configure so we're disabling this
|
||||
# service.
|
||||
useDHCP = false;
|
||||
dhcpcd.enable = false;
|
||||
};
|
||||
|
||||
# Enable systemd-resolved. This is mostly setup by `systemd.network.enable`
|
||||
# by we're being explicit just to be safe.
|
||||
services.resolved = {
|
||||
enable = true;
|
||||
llmnr = "true";
|
||||
};
|
||||
|
||||
# Combining my ethernet and wireless network interfaces.
|
||||
systemd.network = {
|
||||
enable = true;
|
||||
netdevs."40-bond1" = {
|
||||
netdevConfig = {
|
||||
Name = "bond1";
|
||||
Kind = "bond";
|
||||
};
|
||||
};
|
||||
|
||||
networks = {
|
||||
"40-bond1" = {
|
||||
matchConfig.Name = "bond1";
|
||||
networkConfig.DHCP = "yes";
|
||||
};
|
||||
|
||||
"40-bond1-dev1" = {
|
||||
matchConfig.Name = "enp1s0";
|
||||
networkConfig.Bond = "bond1";
|
||||
};
|
||||
|
||||
"40-bond1-dev2" = {
|
||||
matchConfig.Name = "wlp2s0";
|
||||
networkConfig = {
|
||||
Bond = "bond1";
|
||||
IgnoreCarrierLoss = "15";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
|
||||
hardware.cpu.intel.updateMicrocode = lib.mkDefault true;
|
||||
|
||||
|
51
hosts/ni/modules/hardware/systemd-networkd.nix
Normal file
51
hosts/ni/modules/hardware/systemd-networkd.nix
Normal file
@ -0,0 +1,51 @@
|
||||
{ config, options, lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
networking = {
|
||||
usePredictableInterfaceNames = true;
|
||||
useNetworkd = true;
|
||||
|
||||
# We're using networkd to configure so we're disabling this
|
||||
# service.
|
||||
useDHCP = false;
|
||||
dhcpcd.enable = false;
|
||||
};
|
||||
|
||||
# Enable systemd-resolved. This is mostly setup by `systemd.network.enable`
|
||||
# by we're being explicit just to be safe.
|
||||
services.resolved = {
|
||||
enable = false;
|
||||
llmnr = "true";
|
||||
};
|
||||
|
||||
# Combining my ethernet and wireless network interfaces.
|
||||
systemd.network = {
|
||||
enable = false;
|
||||
netdevs."40-bond1" = {
|
||||
netdevConfig = {
|
||||
Name = "bond1";
|
||||
Kind = "bond";
|
||||
};
|
||||
};
|
||||
|
||||
networks = {
|
||||
"40-bond1" = {
|
||||
matchConfig.Name = "bond1";
|
||||
networkConfig.DHCP = "yes";
|
||||
};
|
||||
|
||||
"40-bond1-dev1" = {
|
||||
matchConfig.Name = "enp1s0";
|
||||
networkConfig.Bond = "bond1";
|
||||
};
|
||||
|
||||
"40-bond1-dev2" = {
|
||||
matchConfig.Name = "wlp2s0";
|
||||
networkConfig = {
|
||||
Bond = "bond1";
|
||||
IgnoreCarrierLoss = "15";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
21
hosts/ni/modules/hardware/traditional-networking.nix
Normal file
21
hosts/ni/modules/hardware/traditional-networking.nix
Normal file
@ -0,0 +1,21 @@
|
||||
{ config, options, lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
networking = {
|
||||
usePredictableInterfaceNames = true;
|
||||
|
||||
useDHCP = false;
|
||||
dhcpcd.enable = true;
|
||||
|
||||
interfaces.enp1s0.useDHCP = true;
|
||||
interfaces.wlp2s0.useDHCP = true;
|
||||
|
||||
bonds.bond0 = {
|
||||
driverOptions = {
|
||||
miimon = "100";
|
||||
mode = "active-backup";
|
||||
};
|
||||
interfaces = [ "enp1s0" "wlp2s0" ];
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue
Block a user