mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-28 18:03:04 +00:00
Merge pull request #64364 from JohnAZoidberg/nm-wireless
Allow NetworkManager and wireless together
This commit is contained in:
commit
7782ffb89a
@ -8,6 +8,8 @@ let
|
||||
dynamicHostsEnabled =
|
||||
cfg.dynamicHosts.enable && cfg.dynamicHosts.hostsDirs != {};
|
||||
|
||||
delegateWireless = config.networking.wireless.enable == true && cfg.unmanaged != [];
|
||||
|
||||
# /var/lib/misc is for dnsmasq.leases.
|
||||
stateDirs = "/var/lib/NetworkManager /var/lib/dhclient /var/lib/misc";
|
||||
|
||||
@ -177,10 +179,11 @@ in {
|
||||
basePackages = mkOption {
|
||||
type = types.attrsOf types.package;
|
||||
default = { inherit (pkgs)
|
||||
networkmanager modemmanager wpa_supplicant crda
|
||||
networkmanager modemmanager crda
|
||||
networkmanager-openvpn networkmanager-vpnc
|
||||
networkmanager-openconnect networkmanager-fortisslvpn
|
||||
networkmanager-l2tp networkmanager-iodine; };
|
||||
networkmanager-l2tp networkmanager-iodine; }
|
||||
// optionalAttrs (!delegateWireless) { inherit (pkgs) wpa_supplicant; };
|
||||
internal = true;
|
||||
};
|
||||
|
||||
@ -377,8 +380,11 @@ in {
|
||||
config = mkIf cfg.enable {
|
||||
|
||||
assertions = [
|
||||
{ assertion = config.networking.wireless.enable == false;
|
||||
message = "You can not use networking.networkmanager with networking.wireless";
|
||||
{ assertion = config.networking.wireless.enable == true -> cfg.unmanaged != [];
|
||||
message = ''
|
||||
You can not use networking.networkmanager with networking.wireless.
|
||||
Except if you mark some interfaces as <literal>unmanaged</literal> by NetworkManager.
|
||||
'';
|
||||
}
|
||||
{ assertion = !dynamicHostsEnabled || (dynamicHostsEnabled && cfg.dns == "dnsmasq");
|
||||
message = ''
|
||||
@ -491,18 +497,17 @@ in {
|
||||
path = [ pkgs.iproute pkgs.utillinux pkgs.coreutils ];
|
||||
};
|
||||
|
||||
# Turn off NixOS' network management
|
||||
networking = {
|
||||
# Turn off NixOS' network management when networking is managed entirely by NetworkManager
|
||||
networking = (mkIf (!delegateWireless) {
|
||||
useDHCP = false;
|
||||
# use mkDefault to trigger the assertion about the conflict above
|
||||
# Use mkDefault to trigger the assertion about the conflict above
|
||||
wireless.enable = mkDefault false;
|
||||
};
|
||||
}) // (mkIf cfg.enableStrongSwan {
|
||||
networkmanager.packages = [ pkgs.networkmanager_strongswan ];
|
||||
});
|
||||
|
||||
security.polkit.extraConfig = polkitConf;
|
||||
|
||||
networking.networkmanager.packages =
|
||||
mkIf cfg.enableStrongSwan [ pkgs.networkmanager_strongswan ];
|
||||
|
||||
services.dbus.packages =
|
||||
optional cfg.enableStrongSwan pkgs.strongswanNM ++ cfg.packages;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user