SDR radio with rtl-sdr usb dongle setup

Hi Everyone

I am new to Nixos, below settings work for me, probably there is a more beautiful way :slight_smile:

All the programs are in the store, but there was a little udev setting up, otherwise the device rights were not usable, and also a kernel module blacklisting otherwise the rtl-sdr stick was a dvbt device

As program to listen to radio I use gqrx

I set it up globally in /etc/nixos/configuration.nix

So add somewhere in that file, these lines:

boot.kernelParams = [ "modprobe.blacklist=dvb_usb_rtl28xxu" ]; # blacklist this module

services.udev.packages = [ pkgs.rtl-sdr ]; # (there might be other packages that require udev here too)

And add these packages in the list where your packages already are:

libusb rtl-sdr gqrx

e.g.:

  # List packages installed in system profile. To search, run:
  # $ nix search wget
  environment.systemPackages = with pkgs; [
    wget 
    vim

    libusb
    pkgs.rtl-sdr
    gqrx

  ];

Save and quit your editing, then rebuild your system as usual:

sudo nixos-rebuild switch

Then reboot for blacklisting the dvbt module, enter your system, plug in the rtl-sdr usb stick, start gqrx, it should find the rtl-sdr stick and be able to work with it!

Thanks (for beautiful Nixos)!

4 Likes

Here is what you need:

hardware.rtl-sdr.enable = true;
users.users.<name>.extraGroups = [ "plugdev" ];

Test:

$ rtl_test -t
Found 1 device(s):
  0:  Realtek, RTL2838UHIDIR, SN: 00000001

Using device 0: Generic RTL2832U OEM
Found Rafael Micro R820T tuner
Supported gain values (29): 0.0 0.9 1.4 2.7 3.7 7.7 8.7 12.5 14.4 15.7 16.6 19.7 20.7 22.9 25.4 28.0 29.7 32.8 33.8 36.4 37.2 38.6 40.2 42.1 43.4 43.9 44.5 48.0 49.6 
[R82XX] PLL not locked!
Sampling at 2048000 S/s.
No E4000 tuner found, aborting.
2 Likes

OK, thanks, that is a lot shorter, I guess I forgot to mention the plugdev group membership