mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-09-11 07:15:54 +03:00
nixos/tests/mediamtx: init
This commit is contained in:
parent
362810eabe
commit
4fc07e7b48
@ -463,6 +463,7 @@ in {
|
|||||||
matrix-conduit = handleTest ./matrix/conduit.nix {};
|
matrix-conduit = handleTest ./matrix/conduit.nix {};
|
||||||
matrix-synapse = handleTest ./matrix/synapse.nix {};
|
matrix-synapse = handleTest ./matrix/synapse.nix {};
|
||||||
mattermost = handleTest ./mattermost.nix {};
|
mattermost = handleTest ./mattermost.nix {};
|
||||||
|
mediamtx = handleTest ./mediamtx.nix {};
|
||||||
mediatomb = handleTest ./mediatomb.nix {};
|
mediatomb = handleTest ./mediatomb.nix {};
|
||||||
mediawiki = handleTest ./mediawiki.nix {};
|
mediawiki = handleTest ./mediawiki.nix {};
|
||||||
meilisearch = handleTest ./meilisearch.nix {};
|
meilisearch = handleTest ./meilisearch.nix {};
|
||||||
|
57
nixos/tests/mediamtx.nix
Normal file
57
nixos/tests/mediamtx.nix
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
import ./make-test-python.nix ({ pkgs, lib, ...} :
|
||||||
|
|
||||||
|
{
|
||||||
|
name = "mediamtx";
|
||||||
|
meta.maintainers = with lib.maintainers; [ fpletz ];
|
||||||
|
|
||||||
|
nodes = {
|
||||||
|
machine = { config, ... }: {
|
||||||
|
services.mediamtx = {
|
||||||
|
enable = true;
|
||||||
|
settings = {
|
||||||
|
metrics = true;
|
||||||
|
paths.all.source = "publisher";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
systemd.services.rtmp-publish = {
|
||||||
|
description = "Publish an RTMP stream to mediamtx";
|
||||||
|
after = [ "mediamtx.service" ];
|
||||||
|
bindsTo = [ "mediamtx.service" ];
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
serviceConfig = {
|
||||||
|
DynamicUser = true;
|
||||||
|
Restart = "on-failure";
|
||||||
|
RestartSec = "1s";
|
||||||
|
TimeoutStartSec = "10s";
|
||||||
|
ExecStart = "${lib.getBin pkgs.ffmpeg-headless}/bin/ffmpeg -re -f lavfi -i smptebars=size=800x600:rate=10 -c libx264 -f flv rtmp://localhost:1935/test";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
systemd.services.rtmp-receive = {
|
||||||
|
description = "Receive an RTMP stream from mediamtx";
|
||||||
|
after = [ "rtmp-publish.service" ];
|
||||||
|
bindsTo = [ "rtmp-publish.service" ];
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
serviceConfig = {
|
||||||
|
DynamicUser = true;
|
||||||
|
Restart = "on-failure";
|
||||||
|
RestartSec = "1s";
|
||||||
|
TimeoutStartSec = "10s";
|
||||||
|
ExecStart = "${lib.getBin pkgs.ffmpeg-headless}/bin/ffmpeg -y -re -i rtmp://localhost:1935/test -f flv /dev/null";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
testScript = ''
|
||||||
|
start_all()
|
||||||
|
|
||||||
|
machine.wait_for_unit("mediamtx.service")
|
||||||
|
machine.wait_for_unit("rtmp-publish.service")
|
||||||
|
machine.wait_for_unit("rtmp-receive.service")
|
||||||
|
machine.wait_for_open_port(9998)
|
||||||
|
machine.succeed("curl http://localhost:9998/metrics | grep '^rtmp_conns.*state=\"publish\".*1$'")
|
||||||
|
machine.succeed("curl http://localhost:9998/metrics | grep '^rtmp_conns.*state=\"read\".*1$'")
|
||||||
|
'';
|
||||||
|
})
|
@ -1,6 +1,7 @@
|
|||||||
{ lib
|
{ lib
|
||||||
, fetchFromGitHub
|
, fetchFromGitHub
|
||||||
, buildGoModule
|
, buildGoModule
|
||||||
|
, nixosTests
|
||||||
}:
|
}:
|
||||||
|
|
||||||
buildGoModule rec {
|
buildGoModule rec {
|
||||||
@ -23,6 +24,8 @@ buildGoModule rec {
|
|||||||
"-X github.com/bluenviron/mediamtx/internal/core.version=v${version}"
|
"-X github.com/bluenviron/mediamtx/internal/core.version=v${version}"
|
||||||
];
|
];
|
||||||
|
|
||||||
|
passthru.tests = { inherit (nixosTests) mediamtx; };
|
||||||
|
|
||||||
meta = with lib; {
|
meta = with lib; {
|
||||||
description =
|
description =
|
||||||
"Ready-to-use RTSP server and RTSP proxy that allows to read and publish video and audio streams"
|
"Ready-to-use RTSP server and RTSP proxy that allows to read and publish video and audio streams"
|
||||||
|
Loading…
Reference in New Issue
Block a user