[Solved] How to disable one wifi adapter?

Hi,

I have two wifi adapter on my linux system. Is there an official way to disable the wifi adapter in nixos?

I take a look at the network-interface.nix file but couldn’t find any clue.

Thanks!

1 Like

FYI, doing things like this cannot pass switch

  system.userActivationScripts.disableBuiltinWifiAdapter = ''
    sudo ifconfig wlo1 down
  '';

If the wifi cards use different hardware, you maybe be able to blacklist the kernel module for that wifi card from being loaded.

blacklistedKernelModules

or , if they do use the same hardware and/or kernel driver, then if you maybe able to disable dhcp.

networking.interfaces..useDHCP

just a note , if your going to reference ifconfig from scripts you need.

${pkgs.nettools}/bin/ifconfig $INTERFACE down

when referencing scripts and executable binaries , imagine you don’t have a $PATH set , so you
have to explicitly use a complete absolute path to the thing you need. This has the side effect that if you were to upgrade ifconfig later, then your rebuild would actually rewrite your path to your new ifconfig… sounds crazy doesn’t it…but it works.

maybe you could add a systemd target to bring the interface now, however there might be a more ‘standard way of doing this’.

however IMHO blacklisting i think is the best way to go…

2 Likes

Thanks! blacklistedKernelModules works like charm!

1 Like