70 lines
1.6 KiB
Nix
70 lines
1.6 KiB
Nix
|
|
{
|
||
|
|
lib,
|
||
|
|
nixosTests,
|
||
|
|
fetchFromGitHub,
|
||
|
|
buildNpmPackage,
|
||
|
|
buildGoModule,
|
||
|
|
}:
|
||
|
|
let
|
||
|
|
name = "broadcast-box";
|
||
|
|
version = "0-unstable-2025-06-04";
|
||
|
|
|
||
|
|
src = fetchFromGitHub {
|
||
|
|
repo = "broadcast-box";
|
||
|
|
owner = "Glimesh";
|
||
|
|
rev = "a091f147f750759084a2c9d25a12e815e2feebf8";
|
||
|
|
hash = "sha256-Evhye+DYtFM/VjxqmhH5kU32khvEFUxTUgH9DXytIbo=";
|
||
|
|
};
|
||
|
|
|
||
|
|
frontend = buildNpmPackage {
|
||
|
|
inherit version;
|
||
|
|
pname = "${name}-web";
|
||
|
|
src = "${src}/web";
|
||
|
|
npmDepsHash = "sha256-e1cCezmF20Q6JEXwPb1asRSXuC/GGaR+ImvrTabLl5c=";
|
||
|
|
preBuild = ''
|
||
|
|
# The VITE_API_PATH environment variable is needed
|
||
|
|
cp "${src}/.env.production" ../
|
||
|
|
'';
|
||
|
|
installPhase = ''
|
||
|
|
mkdir -p $out
|
||
|
|
cp -r build $out
|
||
|
|
'';
|
||
|
|
};
|
||
|
|
in
|
||
|
|
buildGoModule {
|
||
|
|
inherit version src frontend;
|
||
|
|
pname = name;
|
||
|
|
vendorHash = "sha256-Jpee7UmG9AB9SOoTv2fPP2l5BmkDPPdciGFu9Naq9h8=";
|
||
|
|
proxyVendor = true; # fixes darwin/linux hash mismatch
|
||
|
|
|
||
|
|
patches = [ ./allow-no-env.patch ];
|
||
|
|
postPatch = ''
|
||
|
|
substituteInPlace main.go \
|
||
|
|
--replace-fail './web/build' '${placeholder "out"}/share'
|
||
|
|
'';
|
||
|
|
|
||
|
|
installPhase = ''
|
||
|
|
runHook preInstall
|
||
|
|
|
||
|
|
mkdir -p $out/share
|
||
|
|
cp -r $frontend/build/* $out/share
|
||
|
|
|
||
|
|
install -Dm755 $GOPATH/bin/broadcast-box -t $out/bin
|
||
|
|
|
||
|
|
runHook postInstall
|
||
|
|
'';
|
||
|
|
|
||
|
|
passthru.tests = {
|
||
|
|
inherit (nixosTests) broadcast-box;
|
||
|
|
};
|
||
|
|
|
||
|
|
meta = {
|
||
|
|
description = "WebRTC broadcast server";
|
||
|
|
homepage = "https://github.com/Glimesh/broadcast-box";
|
||
|
|
license = lib.licenses.mit;
|
||
|
|
maintainers = with lib.maintainers; [ JManch ];
|
||
|
|
platforms = lib.platforms.unix;
|
||
|
|
mainProgram = "broadcast-box";
|
||
|
|
};
|
||
|
|
}
|