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 ?

1 Like

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

Hey - sorry to necro an old thread… And I know I’m new here & everything but just created an account to emphatically second @tcip’s post. I found this thread through google and was confused too why KDE’s plasma-network-manager wasn’t working on a fresh install.

I just now finally fixed it after spending too long - WAY too long on it, and was surprised even after I knew exactly what to do, how much more effort it was than I even initially expected. The plan was to just nixos-rebuild switch after tweaking the configuration.nix in the local OS on my nvme drive, which didn’t work because it requires internet. Uuuhh no problem, I’ll just boot the live CD again and do it there.

On further googling I found this thread on stack exchange - which btw, good thing they mentioned the chroot thing using nixos-enter, because I burned a little chunk of time on that as well, wondering why nixos-rebuild couldn’t take a --root /mnt flag like nixos-generate-config does, and which the documentation says “most nixos commands can use” - (and it looks like that was most of the commenters’ initial hangup as well):

But once I figured out nixos-enter, I couldn’t believe that even then, there was still no love as I got the same error output as the linked answer did, with the message “system has not been booted with systemd as init system. Can’t operate” preceding it. I didn’t have any luck finding a decent fix for that one via googling.

Which meant my only real option at that point was doing everything over from scratch; wiping the drive (requiring nvme-cli, thus also having to dig in the docs learning how to install it with nix-env), partitioning, mounting and nixos-install again etc.

I don’t want to sound catty or too lazy to figure it out or anything, and luckily I had a semi-automated script for the install pre-made (from another more lengthy mission to hell involving several of the last couple days being spent diagnosing UEFI boot due to an unrelated problem with parted not actually wiping the partition tables) so it works now thank god. But in the interest of improving a project that I think deserves it, it’d be a shame if this simple gotcha wasn’t outlined in the documentation, because of how much pain it caused via a really simple oversight. And in this case I truly did RTFM back to front trying to understand what I did wrong, but most importantly; newbies are guaranteed to continue to be dealt grief by this. Just see the stack exchange link for evidence, and IMO it’s pretty clear why - if the nixos syntax has a preconfigured line that says it “enables wireless”, then I at least as a newbie, would expect it to continue working once installed just like it did in the live CD. And finally I’d have to double check but pretty sure the NixOS manual doesn’t breathe a word about the difference between wireless options, actually don’t think it even mentions networkmanager at all. (at least in the installation section)

Thank you for reading my blog post and I hope we could figure out a quick fix for this, I’d be willing to help out if necessary too just let me know.