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, Downloads - SDRplay

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 Packaging/Binaries - NixOS Wiki.

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…

I did not succeed with the above…

For the time being I found a solution with a docker container from:

Not ideal, but I can listen now to radio with SDRPlay receiver hardware on NixOS :slight_smile:

Hi

With NixOS 22.05, there is a driver for sdrplay

I saw sdrplay and soapysdrplay, on the search.nixos.org site

I am trying now to get it to work… :wink:

Hi

I did it!

Via the options part of search.nixos.org

and

https://nixos.wiki/wiki/Overlays

In my configuration.nix:


environment.systemPackages = with pkgs; [
  #  vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
  #  wget
    firefox
    kate
    vim
    mc
    tdesktop
    signal-desktop
    vlc
    sdrplay
    rtl-sdr
    soapysdr
    soapysdrplay
    soapyrtlsdr
    gqrx
    cubicsdr
  ];

  nixpkgs.overlays = [ (self: super: {
    soapysdr-with-plugins = super.soapysdr.override { extraPackages = [ super.soapysdrplay ]; };
  }
  )];

  services.sdrplayApi.enable = true;
  hardware.rtl-sdr.enable = true;

It does some compiling when nixos-rebuild

And it works!

Thank you NixOS community for the beautiful OS, and Philipp Menke for porting sdrplay to NixOS :slight_smile:

2 Likes