diff --git a/hosts/del/configuration.nix b/hosts/del/configuration.nix index 356ed6d..c719219 100644 --- a/hosts/del/configuration.nix +++ b/hosts/del/configuration.nix @@ -144,9 +144,12 @@ in { }; poz = { - other.home-manager = { - enable = true; - enableDirenv = true; + other = { + home-manager = { + enable = true; + enableDirenv = true; + }; + networking.enable = true; }; programs = { agenix.enable = true; diff --git a/hosts/del/profile.nix b/hosts/del/profile.nix index e7a2133..323322c 100644 --- a/hosts/del/profile.nix +++ b/hosts/del/profile.nix @@ -9,7 +9,6 @@ ../../options/common/disk.nix ../../options/common/docs.nix ../../options/common/kernel.nix - ../../options/common/networking.nix ../../options/common/nix.nix ../../options/common/oomd.nix ../../options/common/pin-registry.nix diff --git a/hosts/hape/configuration.nix b/hosts/hape/configuration.nix index 883c5d4..a2bb0d0 100644 --- a/hosts/hape/configuration.nix +++ b/hosts/hape/configuration.nix @@ -46,9 +46,12 @@ }; poz = { - other.home-manager = { - enable = true; - enableDirenv = true; + other = { + home-manager = { + enable = true; + enableDirenv = true; + }; + networking.enable = true; }; programs = { agenix.enable = true; diff --git a/hosts/hape/profile.nix b/hosts/hape/profile.nix index cfcce57..c586140 100644 --- a/hosts/hape/profile.nix +++ b/hosts/hape/profile.nix @@ -9,7 +9,6 @@ ../../options/common/disk.nix ../../options/common/docs.nix ../../options/common/kernel.nix - ../../options/common/networking.nix ../../options/common/nix.nix ../../options/common/oomd.nix ../../options/common/pin-registry.nix diff --git a/hosts/niks/configuration.nix b/hosts/niks/configuration.nix index 4f65849..7263ea9 100644 --- a/hosts/niks/configuration.nix +++ b/hosts/niks/configuration.nix @@ -75,9 +75,12 @@ in { #powerManagement.powertop.enable = true; poz = { - other.home-manager = { - enable = true; - enableDirenv = true; + other = { + home-manager = { + enable = true; + enableDirenv = true; + }; + networking.enable = true; }; programs = { agenix.enable = true; diff --git a/hosts/niks/profile.nix b/hosts/niks/profile.nix index 8c070b3..759786f 100644 --- a/hosts/niks/profile.nix +++ b/hosts/niks/profile.nix @@ -11,7 +11,6 @@ ../../options/common/gpu/amd.nix ../../options/common/kernel.nix ../../options/common/libvirt.nix - ../../options/common/networking.nix ../../options/common/nix.nix ../../options/common/oomd.nix ../../options/common/pin-registry.nix diff --git a/modules/other/default.nix b/modules/other/default.nix index 62620ee..1265a2c 100644 --- a/modules/other/default.nix +++ b/modules/other/default.nix @@ -2,6 +2,7 @@ imports = [ ./hardware.nix ./home-manager.nix + ./networking.nix ./system.nix ./xdg.nix ]; diff --git a/modules/other/networking.nix b/modules/other/networking.nix new file mode 100644 index 0000000..aa23572 --- /dev/null +++ b/modules/other/networking.nix @@ -0,0 +1,52 @@ +{ + config, + lib, + ... +}: let + cfg = config.poz.other.networking; + inherit (config.poz.other.system) username; + + inherit (lib.modules) mkForce mkIf; + inherit (lib.options) mkEnableOption mkOption; + inherit (lib.types) listOf package; +in { + options.poz.other.networking = { + enable = mkEnableOption "networking using NetworkManager"; + plugins = mkOption { + description = "NetworkManager plugins"; + type = listOf package; + default = []; + }; + }; + + config = mkIf cfg.enable { + networking = { + networkmanager = { + enable = true; + dns = "systemd-resolved"; + plugins = mkForce cfg.plugins; + # wifi.backend = "iwd"; + }; + firewall.checkReversePath = "loose"; + }; + + services.resolved = { + enable = true; + fallbackDns = [ + "9.9.9.9" + "2620:fe::fe" + ]; + }; + + # don't wait for network to boot faster + # https://old.reddit.com/r/NixOS/comments/vdz86j/how_to_remove_boot_dependency_on_network_for_a + systemd = { + targets.network-online.wantedBy = mkForce []; # default is [ "multi-user.target" ] + services.NetworkManager-wait-online.wantedBy = mkForce []; # default is [ "network-online.target" ] + }; + + users.users.${username} = { + extraGroups = [ "networkmanager" ]; + }; + }; +} diff --git a/options/common/networking.nix b/options/common/networking.nix deleted file mode 100644 index 6ad5931..0000000 --- a/options/common/networking.nix +++ /dev/null @@ -1,38 +0,0 @@ -{ - config, - lib, - ... -}: let - inherit (config.poz.other.system) username; - - inherit (lib.modules) mkForce; -in { - networking = { - networkmanager = { - enable = true; - dns = "systemd-resolved"; - plugins = mkForce []; - # wifi.backend = "iwd"; - }; - firewall.checkReversePath = "loose"; - }; - - services.resolved = { - enable = true; - fallbackDns = [ - "9.9.9.9" - "2620:fe::fe" - ]; - }; - - # don't wait for network to boot faster - # https://old.reddit.com/r/NixOS/comments/vdz86j/how_to_remove_boot_dependency_on_network_for_a - systemd = { - targets.network-online.wantedBy = mkForce []; # default is [ "multi-user.target" ] - services.NetworkManager-wait-online.wantedBy = mkForce []; # default is [ "network-online.target" ] - }; - - users.users.${username} = { - extraGroups = [ "networkmanager" ]; - }; -}