I am trying to enable concurrent mode feature of this driver as mentioned here:
https://github.com/morrownr/88x2bu-20210702/blob/ecf5014fe0f9f0ee87f84ea2b7472da788fd8627/docs/Concurrent_Mode.md
In order to do this you have to execute a script “./cmode_on.sh” after unpacking the source, but before building.
I have successfully added the module and it works perfectly without concurrent mode, but NixOS handles all the building in the background so I am unsure how to tell NixOS to activate the feature during the install.
I have been reading through the manual, but I am new to NixOS and I cannot tell what would be the correct “Nix way” to do this.
Any help would be much appreciated.
So as far at I see the current NixOs package does not provide any option to turn it on nixpkgs/default.nix at 8ff7b290e6dd47d7ed24c6d156ba60fc3c83f100 · NixOS/nixpkgs · GitHub (see also nixpkgs/linux-kernels.nix at a0bb254735ab64192ea1eb55aac524e4d4973501 · NixOS/nixpkgs · GitHub)
Or the other hand, the cmode-on
script is trivial: it just updates a flag in the Makefile 88x2bu-20210702/cmode-on.sh at ecf5014fe0f9f0ee87f84ea2b7472da788fd8627 · morrownr/88x2bu-20210702 · GitHub
So I would say that for a quick fix the simplest is to add an overlay that replaces the rtl88x2bu
package with your own, that would be a copy/paste of the above (or, cleaner, use overrideAttr
to still receive updates if you want) except that you add a prePatch
phase that either run the cmode-on
script (but you would need to patch it first as it links to /bin/bash) or, simpler, to directly replace the flag in the Makefile by copy/pasting the sed command, or, cleaner, to use substituteInPlace
offered by nix.
If you want I can try to provide you the code. Just not very handy now from my phone.
Actually if you use
boot.kernelModules = [ "88x2bu" ];
boot.extraModulePackages = [
config.boot.kernelPackages.rtl88x2bu
];
To load the packages, you don’t even need overlays. You should be able to just replace it with (sorry not tested I’m on the phone):
boot.kernelModules = [ "88x2bu" ];
boot.extraModulePackages = [
(config.boot.kernelPackages.rtl88x2bu.overrideAttrs (old: {
prePatch = old.prePatch + ''
substituteInPlace Makefile --replace "CONFIG_CONCURRENT_MODE = n" "CONFIG_CONCURRENT_MODE = y"
'';
}))
];
Edit: added old.prePatch + …
Thank you so much for responding!
This was the right path.
I did have to make a slight modification. Apparently there were existing prePatch commands which needed to be in place for the driver to build so I had to append instead of replace it. Here is what ended up working.
boot.extraModulePackages = [
(config.boot.kernelPackages.rtl88x2bu.overrideAttrs (old: {
prePatch = old.prePatch + ''
substituteInPlace Makefile --replace "CONFIG_CONCURRENT_MODE = n" "CONFIG_CONCURRENT_MODE = y"
'';
}))
];
I rebooted after the rebuild completed and now i have two wifi devices!
Thanks so much!
1 Like
Oh good point, I forgot to check if prePatch
was not already used ^^ I edited my answer to avoid having broken code here. If you want, you can maybe contribute to nixpkgs to add this option as a simple override (just add an optional argument in the derivation file and add the above code conditionally). I’m sure it could be helpful to others.
I will see about making that contribution. I have been looking to get into contributing to open source projects and this seems like a good simple first step.
1 Like