nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 buildGoModule,
4 fetchFromGitHub,
5 nixosTests,
6 bash,
7 which,
8 ffmpeg-full,
9 makeBinaryWrapper,
10}:
11let
12 version = "0.2.3";
13in
14buildGoModule {
15 pname = "owncast";
16 inherit version;
17 src = fetchFromGitHub {
18 owner = "owncast";
19 repo = "owncast";
20 rev = "v${version}";
21 hash = "sha256-JCIB4G3cOSkEEO/jcsj4mUP+HeQfgn0jX4OL8NX9/C0=";
22 };
23 vendorHash = "sha256-FuynEBoPS0p1bRgmaeCxn1RPqbYHcltZpQ9SE71xHEE=";
24
25 propagatedBuildInputs = [ ffmpeg-full ];
26
27 nativeBuildInputs = [ makeBinaryWrapper ];
28
29 # lefthook is included as a tool in go.mod for a pre-commit hook, but causes the build to fail
30 preBuild = ''
31 # Remove lefthook from tools section in go.mod
32 sed -i '/tool (/,/)/{ /[[:space:]]*github.com\/evilmartians\/lefthook[[:space:]]*$/d; }' go.mod
33 '';
34
35 postInstall = ''
36 wrapProgram $out/bin/owncast \
37 --prefix PATH : ${
38 lib.makeBinPath [
39 bash
40 which
41 ffmpeg-full
42 ]
43 }
44 '';
45
46 installCheckPhase = ''
47 runHook preCheck
48 $out/bin/owncast --help
49 runHook postCheck
50 '';
51
52 passthru.tests.owncast = nixosTests.owncast;
53
54 meta = {
55 description = "Self-hosted video live streaming solution";
56 homepage = "https://owncast.online";
57 license = lib.licenses.mit;
58 platforms = lib.platforms.unix;
59 maintainers = with lib.maintainers; [
60 flexiondotorg
61 MayNiklas
62 ];
63 mainProgram = "owncast";
64 };
65}