1{ config, lib, pkgs, ... }:
2let
3 cfg = config.services.openwebrx;
4in
5{
6 options.services.openwebrx = with lib; {
7 enable = mkEnableOption (lib.mdDoc "OpenWebRX Web interface for Software-Defined Radios on http://localhost:8073");
8
9 package = mkOption {
10 type = types.package;
11 default = pkgs.openwebrx;
12 defaultText = literalExpression "pkgs.openwebrx";
13 description = lib.mdDoc "OpenWebRX package to use for the service";
14 };
15 };
16
17 config = lib.mkIf cfg.enable {
18 systemd.services.openwebrx = {
19 wantedBy = [ "multi-user.target" ];
20 path = with pkgs; [
21 csdr
22 digiham
23 codec2
24 js8call
25 m17-cxx-demod
26 alsaUtils
27 netcat
28 ];
29 serviceConfig = {
30 ExecStart = "${cfg.package}/bin/openwebrx";
31 Restart = "always";
32 DynamicUser = true;
33 # openwebrx uses /var/lib/openwebrx by default
34 StateDirectory = [ "openwebrx" ];
35 };
36 };
37 };
38}