nixpkgs/pkgs/servers/owncast/default.nix

59 lines
1.4 KiB
Nix
Raw Normal View History

2021-09-22 23:46:17 +01:00
{ lib, buildGoModule, fetchFromGitHub, nixosTests, bash, which, ffmpeg, makeWrapper, coreutils, ... }:
buildGoModule rec {
pname = "owncast";
2021-11-03 19:13:11 +00:00
version = "0.0.10";
2021-09-22 23:46:17 +01:00
src = fetchFromGitHub {
owner = "owncast";
repo = "owncast";
rev = "v${version}";
2021-11-03 19:13:11 +00:00
sha256 = "sha256-OcolQ4KnZbSgS1dpphbCML40jlheKAxbac7rjRul6Oc=";
2021-09-22 23:46:17 +01:00
};
vendorSha256 = "sha256-NARHYeOVT7sxfL1BdJc/CPCgHNZzjWE7kACJvrEC71Y=";
2021-09-22 23:46:17 +01:00
propagatedBuildInputs = [ ffmpeg ];
buildInputs = [ makeWrapper ];
preInstall = ''
mkdir -p $out
cp -r $src/{static,webroot} $out
'';
postInstall = let
setupScript = ''
[ ! -d "$PWD/webroot" ] && (
${coreutils}/bin/cp --no-preserve=mode -r "${placeholder "out"}/webroot" "$PWD"
)
[ ! -d "$PWD/static" ] && (
${coreutils}/bin/ln -s "${placeholder "out"}/static" "$PWD"
)
'';
in ''
wrapProgram $out/bin/owncast \
--run '${setupScript}' \
--prefix PATH : ${lib.makeBinPath [ bash which ffmpeg ]}
'';
installCheckPhase = ''
runHook preCheck
$out/bin/owncast --help
runHook postCheck
'';
passthru.tests.owncast = nixosTests.testOwncast;
meta = with lib; {
description = "self-hosted video live streaming solution";
homepage = "https://owncast.online";
license = licenses.mit;
platforms = platforms.unix;
maintainers = with maintainers; [ MayNiklas ];
};
}