initial commit
This commit is contained in:
17
configuration/rtmp-auth/config.toml
Normal file
17
configuration/rtmp-auth/config.toml
Normal 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"
|
||||
7
configuration/rtmp-auth/default.nix
Normal file
7
configuration/rtmp-auth/default.nix
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
# imports = [
|
||||
# ./module.nix
|
||||
# ];
|
||||
#
|
||||
# services.rtmp-auth.enable = true;
|
||||
}
|
||||
40
configuration/rtmp-auth/module.nix
Normal file
40
configuration/rtmp-auth/module.nix
Normal 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;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
28
configuration/rtmp-auth/package.nix
Normal file
28
configuration/rtmp-auth/package.nix
Normal 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;
|
||||
|
||||
})
|
||||
Reference in New Issue
Block a user