summaryrefslogtreecommitdiffstats
path: root/nixos/modules/services/web-apps/openwebrx.nix
blob: f8c19fa7ed7f60de6325d73365db611026bb3a66 (plain)
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
36
37
38
{
  config,
  lib,
  pkgs,
  ...
}:
let
  cfg = config.services.openwebrx;
in
{
  options.services.openwebrx = with lib; {
    enable = mkEnableOption "OpenWebRX Web interface for Software-Defined Radios on http://localhost:8073";

    package = mkPackageOption pkgs "openwebrx" { };
  };

  config = lib.mkIf cfg.enable {
    systemd.services.openwebrx = {
      wantedBy = [ "multi-user.target" ];
      path = with pkgs; [
        csdr
        digiham
        codec2
        js8call
        m17-cxx-demod
        alsa-utils
        netcat
      ];
      serviceConfig = {
        ExecStart = "${cfg.package}/bin/openwebrx";
        Restart = "always";
        DynamicUser = true;
        # openwebrx uses /var/lib/openwebrx by default
        StateDirectory = [ "openwebrx" ];
      };
    };
  };
}