mirror of
https://github.com/youwen5/nixos.git
synced 2025-01-18 05:02:10 -08:00
refactor: move core.networking to networking
This commit is contained in:
parent
8fb6e79cb5
commit
11762d6c0e
3 changed files with 23 additions and 30 deletions
|
@ -46,23 +46,6 @@ in
|
|||
'';
|
||||
};
|
||||
suppressWarnings = lib.mkEnableOption "suppress warnings";
|
||||
networking = {
|
||||
enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = true;
|
||||
description = ''Whether to set up and enable networking daemons.'';
|
||||
};
|
||||
backend = lib.mkOption {
|
||||
type = lib.types.enum [
|
||||
"wpa_supplicant"
|
||||
"iwd"
|
||||
];
|
||||
default = "wpa_supplicant";
|
||||
description = ''
|
||||
Which backend to use for networking. Default is wpa_supplicant with NetworkManager as a frontend. With iwd, iwctl is the frontend.
|
||||
'';
|
||||
};
|
||||
};
|
||||
bluetooth.enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = true;
|
||||
|
@ -161,19 +144,6 @@ in
|
|||
|
||||
hardware.enableRedistributableFirmware = true;
|
||||
|
||||
networking.networkmanager.enable = lib.mkIf (
|
||||
cfg.networking.enable && cfg.networking.backend == "wpa_supplicant"
|
||||
) true;
|
||||
|
||||
systemd.services.NetworkManager-wait-online.enable = lib.mkIf (
|
||||
cfg.networking.enable && cfg.networking.backend == "wpa_supplicant"
|
||||
) false;
|
||||
|
||||
networking.wireless.iwd = lib.mkIf (cfg.networking.enable && cfg.networking.backend == "iwd") {
|
||||
enable = true;
|
||||
settings.General.EnableNetworkConfiguration = true;
|
||||
};
|
||||
|
||||
programs.gnupg.agent = {
|
||||
enable = true;
|
||||
enableSSHSupport = true;
|
||||
|
|
|
@ -31,6 +31,16 @@ in
|
|||
vite = lib.mkEnableOption "firewall ports for Vite";
|
||||
};
|
||||
cloudflareNameservers.enable = lib.mkEnableOption "Cloudflare DNS servers";
|
||||
backend = lib.mkOption {
|
||||
type = lib.types.enum [
|
||||
"wpa_supplicant"
|
||||
"iwd"
|
||||
];
|
||||
default = "wpa_supplicant";
|
||||
description = ''
|
||||
Which backend to use for networking. Default is wpa_supplicant with NetworkManager as a frontend. With iwd, iwctl is the frontend.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
|
@ -55,5 +65,17 @@ in
|
|||
"1.1.1.1"
|
||||
"1.0.0.1"
|
||||
];
|
||||
|
||||
networking.networkmanager.enable = lib.mkIf (cfg.enable && cfg.backend == "wpa_supplicant") true;
|
||||
|
||||
systemd.services.NetworkManager-wait-online.enable = lib.mkIf (
|
||||
cfg.enable && cfg.backend == "wpa_supplicant"
|
||||
) false;
|
||||
|
||||
networking.wireless.iwd = lib.mkIf (cfg.enable && cfg.backend == "iwd") {
|
||||
enable = true;
|
||||
settings.General.EnableNetworkConfiguration = true;
|
||||
};
|
||||
|
||||
};
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
networking = {
|
||||
firewallPresets.vite = true;
|
||||
cloudflareNameservers.enable = true;
|
||||
backend = "iwd";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue