move networking to modules in prep for work laptop

This commit is contained in:
jacekpoz 2024-08-27 15:48:04 +02:00
parent e1ae29834e
commit e628f55645
Signed by: poz
SSH key fingerprint: SHA256:JyLeVWE4bF3tDnFeUpUaJsPsNlJyBldDGV/dIKSLyN8
9 changed files with 71 additions and 50 deletions

View file

@ -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;

View file

@ -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

View file

@ -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;

View file

@ -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

View file

@ -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;

View file

@ -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

View file

@ -2,6 +2,7 @@
imports = [
./hardware.nix
./home-manager.nix
./networking.nix
./system.nix
./xdg.nix
];

View file

@ -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" ];
};
};
}

View file

@ -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" ];
};
}