about summary refs log tree commit diff
path: root/nixos/modules/services/misc/sdrplay.nix
blob: 2d5333e3885b845ff590b3bce7953095b9c3b016 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
{ config, lib, pkgs, ... }:
with lib;
{
  options.services.sdrplayApi = {
    enable = mkOption {
      default = false;
      example = true;
      description = lib.mdDoc ''
        Whether to enable the SDRplay API service and udev rules.

        ::: {.note}
        To enable integration with SoapySDR and GUI applications like gqrx create an overlay containing
        `soapysdr-with-plugins = super.soapysdr.override { extraPackages = [ super.soapysdrplay ]; };`
        :::
      '';
      type = lib.types.bool;
    };
  };

  config = mkIf config.services.sdrplayApi.enable {
    systemd.services.sdrplayApi = {
      description = "SDRplay API Service";
      after = [ "network.target" ];
      wantedBy = [ "multi-user.target" ];
      serviceConfig = {
        ExecStart = "${pkgs.sdrplay}/bin/sdrplay_apiService";
        DynamicUser = true;
        Restart = "on-failure";
        RestartSec = "1s";
      };
    };
    services.udev.packages = [ pkgs.sdrplay ];

  };
}