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