From f0796912bc1603910be26d2bd5fc6365b003f8c5 Mon Sep 17 00:00:00 2001 From: MayNiklas Date: Thu, 23 Sep 2021 00:46:17 +0200 Subject: [PATCH] owncast: init at 0.0.8 --- pkgs/servers/owncast/default.nix | 59 ++++++++++++++++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 ++ 2 files changed, 61 insertions(+) create mode 100644 pkgs/servers/owncast/default.nix diff --git a/pkgs/servers/owncast/default.nix b/pkgs/servers/owncast/default.nix new file mode 100644 index 000000000000..7359b8c2bae4 --- /dev/null +++ b/pkgs/servers/owncast/default.nix @@ -0,0 +1,59 @@ +{ lib, buildGoModule, fetchFromGitHub, nixosTests, bash, which, ffmpeg, makeWrapper, coreutils, ... }: + +buildGoModule rec { + + pname = "owncast"; + version = "0.0.8"; + + src = fetchFromGitHub { + owner = "owncast"; + repo = "owncast"; + rev = "v${version}"; + sha256 = "0md4iafa767yxkwh6z8zpcjv9zd79ql2wapx9vzyd973ksvrdaw2"; + }; + + vendorSha256 = "sha256-bH2CWIgpOS974/P98n0R9ebGTJ0YoqPlH8UmxSYNHeM="; + + 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 ]; + }; + +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 16abc141d983..147361e25547 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -7830,6 +7830,8 @@ with pkgs; operator-sdk = callPackage ../development/tools/operator-sdk { }; + owncast = callPackage ../servers/owncast { }; + update-dotdee = with python3Packages; toPythonApplication update-dotdee; update-nix-fetchgit = haskell.lib.justStaticExecutables haskellPackages.update-nix-fetchgit;