Hey everyone,
(Reciting the whole story here, in case someone runs into the same problem. But the real problem is in the last paragraph)
I have an USB-C ethernet dongle. It works fine on ubuntu, but it didn’t on nixos. So I connected it and had a look with lshw
. Beside my built-in wireless and ethernet interfaces, there was a third:
$ sudo lshw -C network
*-network DISABLED
...omitted...
After some googling it seemed that DISABLED
indicates the interface is off, so I tried turning it on:
$ sudo ifconfig enp61s0u1u3 up
Now the DISABLED was gone, but it did not connect to the internet still. Then, after some more searching, someone suggested that if it’s on but there’s no internet connection, your DHCP might be off. So then I realized I need to add this interface to my configuration.nix
:
networking.interfaces.enp61s0u1u3.useDHCP = true;
After a sudo nixos-rebuild switch
and a reboot the internet connection worked as expected!
Now, the actual problem: by adding this line to my configuration.nix
this interface is always enabled on boot. However, this means the interface will also be enabled if the dongle is disconnected. This results in a 1 minute and 30 seconds waiting period when booting, as starting this interface blocks the boot process, which takes a while to time out since the interface is not there. Is there a way to enable this interface only if it’s there? Or should I add some manual commands to start this interface? I would like to move around with my laptop, so it’d be nice if this interface was enabled once I plug it in. The deprecated global useDHCP
options seems to address my use case, but it seems like it will be removed soon…?