45 lines
1000 B
Nix
45 lines
1000 B
Nix
{ self, system, config, lib, pkgs, ... }:
|
|
let
|
|
cfg = config.services.openwebrx;
|
|
in
|
|
{
|
|
options.services.openwebrx = {
|
|
enable = lib.mkEnableOption "Enable OpenWebRX Web interface for Software-Defined Radios";
|
|
|
|
package = lib.mkOption {
|
|
default = pkgs.openwebrx;
|
|
};
|
|
};
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
users = {
|
|
users.openwebrx = {
|
|
isSystemUser = true;
|
|
group = "openwebrx";
|
|
home = "/var/lib/openwebrx";
|
|
};
|
|
groups.openwebrx = {};
|
|
};
|
|
|
|
systemd.services.openwebrx = {
|
|
wantedBy = [ "multi-user.target" ];
|
|
path = [
|
|
cfg.package.csdr
|
|
pkgs.alsaUtils
|
|
pkgs.netcat
|
|
];
|
|
serviceConfig = {
|
|
ExecStart = "${cfg.package}/bin/openwebrx";
|
|
Restart = "always";
|
|
User = "openwebrx";
|
|
Groups = "openwebrx";
|
|
WorkingDirectory = "/var/lib/openwebrx";
|
|
};
|
|
};
|
|
|
|
systemd.tmpfiles.rules = [
|
|
"d /var/lib/openwebrx 0755 openwebrx openwebrx -"
|
|
];
|
|
};
|
|
}
|