radiobert: plug in bladerf

This commit is contained in:
Astro 2021-10-08 00:34:39 +02:00
parent b3e5b24569
commit fb7ec49b66
1 changed files with 32 additions and 1 deletions

View File

@ -1,5 +1,13 @@
{ hostRegistry, config, lib, pkgs, modulesPath, ... }:
let
# soapysdr = with pkgs; soapysdr.override {
# extraPackages = [
# soapyhackrf
# ];
# };
soapysdr = pkgs.soapysdr-with-plugins;
in
{
boot.initrd.availableKernelModules = [ "usbhid" ];
boot.initrd.kernelModules = [ ];
@ -80,6 +88,7 @@
nameservers = [ "172.20.73.8" "9.9.9.9" ];
};
hardware.bladeRF.enable = true;
users.users.soapysdr = {
isSystemUser = true;
group = "soapysdr";
@ -88,7 +97,7 @@
systemd.services.soapysdr-server = {
wantedBy = [ "multi-user.target" ];
serviceConfig = {
ExecStart = "${pkgs.soapysdr-with-plugins}/bin/SoapySDRServer --bind";
ExecStart = "${soapysdr}/bin/SoapySDRServer --bind";
User = "soapysdr";
Group = "soapysdr";
ProtectSystem = "full";
@ -96,6 +105,27 @@
};
};
systemd.services.bladerf-fpga-bitstream = {
wantedBy = [ "multi-user.target" ];
serviceConfig = {
ExecStart =
let
# bitstream = pkgs.fetchurl {
# url = "https://www.nuand.com/fpga/hostedx40-latest.rbf";
# sha256 = "0fx95rm4004hfxc1708sf35m342iksdhcqiffgxhgkqjd6rxjpz1";
# };
# Matches libbladeRF-2.2.1
bitstream = pkgs.fetchurl {
url = "https://www.nuand.com/fpga/v0.10.2/hostedx40.rbf";
sha256 = "091qiyw971wwbl1z49n8miqmjk4h5m8bv4nyc5zf77j5jjl74j5b";
};
in ''${pkgs.libbladeRF}/bin/bladeRF-cli -d "libusb: instance=0" -l ${bitstream}'';
RemainAfterExit = true;
};
};
services.collectd.plugins = {
curl_json = ''
<URL "http://localhost:8073/metrics.json">
@ -135,6 +165,7 @@
wget
dump1090_sdrplus
soapysdr-with-plugins
libbladeRF
];
programs.tmux.enable = true;