1
0
forked from c3d2/nix-config
nix-config/lib/openwebrx.nix
2021-09-23 03:32:17 +02:00

46 lines
1001 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
cfg.package.csdr
pkgs.alsaUtils
pkgs.netcat
];
serviceConfig = {
ExecStart = "openwebrx";
Restart = "always";
User = "openwebrx";
Groups = "openwebrx";
WorkingDirectory = "/var/lib/openwebrx";
};
};
systemd.tmpfiles.rules = [
"d /var/lib/openwebrx 0755 openwebrx openwebrx -"
];
};
}