How can I connect to wifi after resuming from suspension?

I would like to my NixOS run these commands after resuming from suspension:

  powerManagement.resumeCommands = ''
    echo "This should show up in the journal after resuming."
    echo "Connecting to Wifi after resuming."
    sleep 5
    rmmod iwldvm iwlwifi
    modprobe iwldvm iwlwifi
    sleep 1
    nmcli connection up Redmi
    echo "end of connecting to Redmi"
  '';

Does anyone know why this command doesn’t work for me?

1 Like

You might need to give the full path (thus the package), by default system doesn’t have a PATH which includes for example “nmcli” command as far as I know.

Here is a part from my config:

    resumeCommands = ''
      ${pkgs.utillinux}/bin/rfkill unblock wlan
    '';
3 Likes