Files
2026-05-14 13:39:10 +02:00

41 lines
1.2 KiB
Nix

{ pkgs, lib, config, ... }:
let cfg = config.services.rtmp-auth; in
{
options.services.rtmp-auth = {
enable = lib.mkEnableOption "rtmp-auth";
package = lib.mkOption {
description = "package to use";
default = pkgs.callPackage ./package.nix {};
type = lib.types.package;
};
host = lib.mkOption {
description = "hostname or address to bind to";
default = "localhost";
type = lib.types.str;
};
apiPort = lib.mkOption {
description = "portnumber for the api";
default = 8000;
type = lib.types.port;
};
frontendPort = lib.mkOption {
description = "portnumber for the frontend";
default = 8001;
type = lib.types.port;
};
};
config = lib.mkIf cfg.enable {
systemd.services.rtmp-auth = {
wantedBy = [ "default.target" ];
requiredBy = [ "network.target" ];
description = "rtmp authentication";
serviceConfig = {
Type = "simple";
ExecStart = ''${pkgs.lib.getExe cfg.package} -config ${./config.toml} -apiAddr "${cfg.host}:${toString cfg.apiPort}" -frontendAddr "${cfg.host}:${toString cfg.frontendPort}" '';
Restart = "on-failure";
RestartSec = 30;
};
};
};
}