2025-07-07 20:19:49 +02:00

61 lines
1.7 KiB
Nix

{
lib,
buildGoModule,
fetchFromGitHub,
fetchurl,
nixosTests,
}:
let
hlsJs = fetchurl {
url = "https://cdn.jsdelivr.net/npm/hls.js@v1.6.6/dist/hls.min.js";
hash = "sha256-/h3dYaJYJLB1VfHXjr2sqjCqZ+c+ngKhEYgmZAgsRlE=";
};
in
buildGoModule (finalAttrs: {
pname = "mediamtx";
# check for hls.js version updates in internal/servers/hls/hlsjsdownloader/VERSION
version = "1.13.0";
src = fetchFromGitHub {
owner = "bluenviron";
repo = "mediamtx";
tag = "v${finalAttrs.version}";
hash = "sha256-/ngWlUKhvRJEb3JN5yUFVziMPxo/YY8CiN2UBJUglqs=";
};
vendorHash = "sha256-LBxE2X1aJPoK/e5Z9Rw9XTjucYOj/bdDUVsPbRDiVOE=";
postPatch = ''
cp ${hlsJs} internal/servers/hls/hls.min.js
echo "v${finalAttrs.version}" > internal/core/VERSION
# disable binary-only rpi camera support
substituteInPlace internal/staticsources/rpicamera/camera_disabled.go \
--replace-fail '!linux || (!arm && !arm64)' 'linux || !linux'
substituteInPlace internal/staticsources/rpicamera/{camera,params_serialize,pipe}.go \
--replace-fail '(linux && arm) || (linux && arm64)' 'linux && !linux'
substituteInPlace internal/staticsources/rpicamera/camera_32.go \
--replace-fail 'linux && arm' 'linux && !linux'
substituteInPlace internal/staticsources/rpicamera/camera_64.go \
--replace-fail 'linux && arm64' 'linux && !linux'
'';
subPackages = [ "." ];
# Tests need docker
doCheck = false;
passthru.tests = {
inherit (nixosTests) mediamtx;
};
meta = {
description = "SRT, WebRTC, RTSP, RTMP, LL-HLS media server and media proxy";
inherit (finalAttrs.src.meta) homepage;
license = lib.licenses.mit;
mainProgram = "mediamtx";
maintainers = with lib.maintainers; [ fpletz ];
};
})