Can’t enable Wifi on fresh Nixos19.09

Hello everyone,

I’m finally switching to Nixos, and it’s already so much fun :D! Thanks to anyone involved, for all your tremendous work and amazing ideas!

I tried to find a relevant answer to my problem on the Web and in this Discourse – and my question have popped already several times, sorry… – but I still don’t do things right :confused:. So I thought I might finally ask.

I’m always using ethernet at home, but I wanted to try to enable Wifi for outside work. I’m using a Clevo N650DU and my Wifi card is an Intel AC8265:

lspci -nn -s 01:00.0
01:00.0 Network controller [0280]: Intel Corporation Wireless 8265 / 8275 [8086:24fd] (rev 78)

Everything went fine with the .iso installation (with networking.wireless.enable = true;), but when I rebooted and tried to change anything, as long as I kept networking.wireless.enable to true, I was greeted by this error:

warning: the following units failed: wpa_supplicant.service

● wpa_supplicant.service - WPA Supplicant
   Loaded: loaded (/nix/store/gkwrv6w6p2149g56l6iyfdvpxfvnwfrq-unit-wpa_supplicant.service/wpa_supplicant.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Wed 2019-11-20 23:27:44 CET; 202ms ago
  Process: 5902 ExecStart=/nix/store/61qpml1c251gyslppmyy6hwp2sh3a673-unit-script-wpa_supplicant-start (code=exited, status=255/EXCEPTION)
 Main PID: 5902 (code=exited, status=255/EXCEPTION)
       IP: 0B in, 0B out
      CPU: 11ms

nov. 20 23:27:44 nixos systemd[1]: Started WPA Supplicant.
nov. 20 23:27:44 nixos wpa_supplicant[5902]: Successfully initialized wpa_supplicant
nov. 20 23:27:44 nixos wpa_supplicant[5902]: Failed to open config file '/etc/wpa_supplicant.conf', error: No such file or directory
nov. 20 23:27:44 nixos wpa_supplicant[5902]: Failed to read or parse configuration '/etc/wpa_supplicant.conf'.
nov. 20 23:27:44 nixos systemd[1]: wpa_supplicant.service: Main process exited, code=exited, status=255/EXCEPTION
nov. 20 23:27:44 nixos systemd[1]: wpa_supplicant.service: Failed with result 'exit-code'.
warning: error(s) occurred while switching to the new configuration

Following other threads on this Discourse, I tried to reboot on the .iso, without being connected via ethernet, stopped NetworkManager and tried to use wpa_supplicant to connect to my Wifi but here is what I got:

wpa_supplicant -B -i wlp1s0 -c <(wpa_passphrase '<mySSID>' '<myPassword>')
Successfully initialized wpa_supplicant
Failed to open config file '/dev/fd/63', error: No such file or directory
Failed to read or parse configuration '/dev/fd/63'.

I hope everything is clear and that I provided enough informations.
Thanks in advance and all the best,

Sorry for the up, but I formatted my partition and restarted from scratch – still the same wpa_supplicant error…
Any idea on what I could try?

I’m currently running:

  • OS: NixOS 19.09.1446.7ee5dc02321 (Loris)
  • Kernel: x86_64 Linux 5.3.13
  • DE: KDE 5.61.0 / Plasma 5.16.5
  • WM: KWin
  • GTK Theme: Breeze [GTK2]

All the best,

I’ve been thinking about something – I’m also running another partition on my laptop with latest Manjaro 4.19.85-1 kernel, and everything is working fine, out of the box. Indeed, the Intel AC8265 is Linux compatible for kernel ≥ 4.1.

Is there something to do with iwlwifi, since Intel says:

Firmware usually ships with your distribution, or you can download from the table below.

If so, what is the NixOS way to properly add the driver to my system?

In case it might help, here is my default generated hardware-configuration.nix:

# Do not modify this file!  It was generated by ‘nixos-generate-config’
# and may be overwritten by future invocations.  Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, ... }:

  imports =
    [ <nixpkgs/nixos/modules/installer/scan/not-detected.nix>

  boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usb_storage" "usbhid" "sd_mod" "sr_mod" "rtsx_pci_sdmmc" ];
  boot.initrd.kernelModules = [ ];
  boot.kernelModules = [ "kvm-intel" ];
  boot.extraModulePackages = [ ];

  fileSystems."/" =
    { device = "/dev/disk/by-uuid/85755dd9-dca0-4c61-9487-061b73ca04d0";
      fsType = "ext4";

  fileSystems."/boot" =
    { device = "/dev/disk/by-uuid/E79C-79CF";
      fsType = "vfat";

  swapDevices =
    [ { device = "/dev/disk/by-uuid/55e0808f-a0c4-48a6-b6a5-8cb404910f03"; }

  nix.maxJobs = lib.mkDefault 8;
  powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";

Hoping I will find some help :wink:!

Hello Thomas,

Have you tried enabling NetworkManager ?

@Elyhaka Nailed it! Thanks a lot, you made my day :smile:!

I had to disable networking.wireless to enable networking.networkmanager as stated in the comment of the documentation:

Note: networking.networkmanager and networking.wireless (WPA Supplicant) cannot be enabled at the same time: you can still connect to the wireless networks using NetworkManager.

Why is it not the default configuration.nix option?

If you were on a server, you might not want to start NetworkManager to handle your network configuration. On my desktop computer, I do not use NetworkManager since I always use static IPs.

It’s yours to decide the balance between configuration ease and the overhead of having a service dedicated to this sole role.

@Elyhaka Of course, I do understand and agree with the fact that the system should help anyone choosing what is right for him/her. What I meant is that maybe networking.networkmanager.enable (defaulting to false) should be proposed instead of networking.wireless.enable in the first generated configuration.nix. Although I still do not get why one did work while the other not – and that’s why it has all the chances of being just a lazy and stupid noob idea :fearful:.