SDRplay API driver V2.13 install on Nixos

Hi Everyone

I hope this is the good category to ask this, about the installation of a Linux driver of a Software Defined Radio receiver connected via USB

On the website of SDRplay, downloads section, https://www.sdrplay.com/downloads/

There is a linux tab, and then you see: API/HW Driver – v2.13 (20th Jun 2018)

Screenshot_20200730_221251

When you download you get a file: SDRplay_RSP_API-Linux-2.13.1.run

It is a kind of self extracting shell script, with an option --keep you can see what is inside, because it then does not erase temporary files, in a folder “package”

There is a chip driver library (libmirsdrapi-rsp.so.2.13) and an udev (66-mirics.rules) file, that seem the most important files, of course this install script expects FHS

Then for example I would like to run the ads-b dump program: ADS-B (dump1090) v1.3.1 (11th Jul 2018), found on the same linux tab

Is there someone that can help me with getting this to work on Nixos?

Thank you very much!

Edit: after a while I found how to add an udev rule to configuration.nix:

services.udev = {
      path = [ pkgs.coreutils ];
      extraRules = ''
        SUBSYSTEM=="usb",ENV{DEVTYPE}=="usb_device",ATTRS{idVendor}=="1df7",ATTRS{idProduct}=="2500",MODE:="0666"
        SUBSYSTEM=="usb",ENV{DEVTYPE}=="usb_device",ATTRS{idVendor}=="1df7",ATTRS{idProduct}=="3000",MODE:="0666"
        SUBSYSTEM=="usb",ENV{DEVTYPE}=="usb_device",ATTRS{idVendor}=="1df7",ATTRS{idProduct}=="3010",MODE:="0666"
        SUBSYSTEM=="usb",ENV{DEVTYPE}=="usb_device",ATTRS{idVendor}=="1df7",ATTRS{idProduct}=="3020",MODE:="0666"
      '';
    };

So that leaves running the provided ads-b dump program, with the libmirsdrapi-rsp.so.2.13 library, I guess…

Seems like the “quick-and-dirty” way to get this running is to simply patchelf the provided binary and library by doing something like the steps described in https://nixos.wiki/wiki/Packaging/Binaries#Manual_Method.

This will probably break if the libraries in NixOS are ever updated and you perform a GC run, so the proper approach would be to write a derivation (nixpkgs has plenty of examples on how to deal with proprietary software packaging, it’s also documented on the same wiki page).

Thank you @casept

Tried a few things, but they did not work

I am studying on it :wink:

Still trying getting the big picture, how all the tools are related…