initial commit

This commit is contained in:
2026-05-14 13:39:10 +02:00
commit 7e444146d2
37 changed files with 1537 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
[http]
# List of RTMP apps
applications = ["stream"]
# Path prefix to allow frontend to run on a subpath
prefix = ""
# Allow CSRF cookie to be sent across http-connection, not recommended for production
insecure = true
[store]
# Set store backend (file|consul)
#backend = "file"
[store.file]
# Configure file storage path relative to working directory
#path = "store.db"

View File

@@ -0,0 +1,7 @@
{
# imports = [
# ./module.nix
# ];
#
# services.rtmp-auth.enable = true;
}

View File

@@ -0,0 +1,40 @@
{ 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;
};
};
};
}

View File

@@ -0,0 +1,28 @@
{ lib
, buildGoModule
, fetchFromGitHub
, statik
, protobuf
, protoc-gen-go
}: buildGoModule (finalAttrs: {
pname = "rtmp-auth";
version = "1.1.0";
src = ./src; /* fetchFromGitHub {
owner = "voc";
repo = "${finalAttrs.pname}";
rev = "master";
hash = "sha256-71PvNBKdvkNSqwCHWZZVAHPa1eEx1Ba3RZqmLy4CBn8=";
};
*/
preBuild = ''
PATH=$PATH:${protoc-gen-go}/bin ${lib.getExe protobuf} -I=storage/ --go_opt=paths=source_relative --go_out=storage/ storage/storage.proto
${lib.getExe statik} -f -src=public/ -dest=.
'';
vendorHash = "sha256-rZZMLZtCvXJmMKYr4rPLTaHqtV6QouKClZgRYlJM1sw=";
meta.mainProgram = finalAttrs.pname;
})