Laptop keeps disconnecting from wifi

I am using NixOS on a macbook air 2017. It has been working great, however the wifi will occasionally disconnect, seemingly whenever I am doing network-intensive tasks. This only happens on one specific network, others I have spent plenty of time on and do not have this problem. These are the associated logs on one such disconnect:

Jan 06 09:22:05 <HOSTNAME> NetworkManager[807]: <warn>  [1704558125.3310] device (wlp3s0): Activation: (wifi) association took too long, failing activation
Jan 06 09:22:05 <HOSTNAME> NetworkManager[807]: <warn>  [1704558125.3336] platform-linux: do-change-link[2]: failure 23 (Too many open files in system) (assume success changing address)
Jan 06 09:22:05 <HOSTNAME> NetworkManager[807]: <warn>  [1704558125.3342] device (wlp3s0): Activation: failed for connection '<SSID>'
Jan 06 09:22:09 <HOSTNAME> NetworkManager[807]: <warn>  [1704558129.9639] platform-linux: do-change-link[2]: failure 23 (Too many open files in system) (assume success changing address)
Jan 06 09:22:10 <HOSTNAME> systemd[1]: Starting Network Manager Script Dispatcher Service...
Jan 06 09:22:10 <HOSTNAME> systemd[1]: Started Network Manager Script Dispatcher Service.
Jan 06 09:22:20 <HOSTNAME> systemd[1]: NetworkManager-dispatcher.service: Deactivated successfully.

Here are the related options in my configuration.nix for kernel modules and networking settings:

  # Bootloader.
  boot = {
    loader.systemd-boot.enable = true;
    loader.efi.canTouchEfiVariables = true;
    kernelParams = [ "acpi_osi=" ];
    kernelModules= [ "kvm-intel" "i915" ];
    extraModulePackages = [ config.boot.kernelPackages.broadcom_sta ];
    kernel.sysctl = {
      "fs.file-max" = 65536;
      "net.core.wmem_max" = 12582912;
      "i915.enable_rc6" = 7;
    };
  };

  # Network settings.
  networking.hostName = "<HOSTNAME>";
  networking.networkmanager = {
    enable = true;
    dns = "default";
    wifi.powersave = false;
  };
  security.pam.loginLimits = [{
    domain = "*";
    type = "soft";
    item = "nofile";
    value = 65536;
  }];

I have the broadcom_sta drivers which allows wireless networking to work for my hardware, and I increased the file max to 65536 in hopes of reducing this error. Wired connections work fine. I have recently updated my entire system and still see this error, and am on the unstable channel for nixpkgs, and my NixOS version is 24.05pre565234.bd645e8668ec (Uakari). The relevant wifi network works fine for my other laptops (windows & macOS), only on my nixos machine does it disconnect every hour or so.

1 Like