63 lines
1.4 KiB
Nix
63 lines
1.4 KiB
Nix
{
|
|
lib,
|
|
buildNpmPackage,
|
|
importNpmLock,
|
|
nodejs,
|
|
ffmpeg-headless,
|
|
makeWrapper,
|
|
}:
|
|
|
|
let
|
|
root = ../.;
|
|
|
|
src = lib.fileset.toSource {
|
|
inherit root;
|
|
fileset = lib.fileset.unions [
|
|
../src
|
|
../providers
|
|
../package.json
|
|
../package-lock.json
|
|
];
|
|
};
|
|
|
|
pkgJson = lib.importJSON ../package.json;
|
|
in
|
|
|
|
assert lib.assertMsg (lib.versionAtLeast nodejs.version "22") "bug-tv needs node >= 22";
|
|
|
|
buildNpmPackage {
|
|
pname = "bug-tv";
|
|
inherit (pkgJson) version;
|
|
inherit src nodejs;
|
|
|
|
# no lockfile hash to keep in sync: deps are fetched per-package from package-lock.json
|
|
npmDeps = importNpmLock { npmRoot = src; };
|
|
npmConfigHook = importNpmLock.npmConfigHook;
|
|
|
|
# webtorrent's optional native deps (bufferutil, utf-8-validate, node-datachannel) are not needed
|
|
npmFlags = [ "--ignore-scripts" ];
|
|
dontNpmBuild = true;
|
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
|
|
|
installPhase = ''
|
|
runHook preInstall
|
|
|
|
mkdir -p $out/lib/bug-tv
|
|
cp -r src providers node_modules package.json $out/lib/bug-tv/
|
|
|
|
makeWrapper ${lib.getExe nodejs} $out/bin/bug-tv \
|
|
--add-flags $out/lib/bug-tv/src/server.js \
|
|
--prefix PATH : ${lib.makeBinPath [ ffmpeg-headless ]}
|
|
|
|
runHook postInstall
|
|
'';
|
|
|
|
meta = {
|
|
description = pkgJson.description;
|
|
homepage = "https://git.bug.tools/bug/tv";
|
|
mainProgram = "bug-tv";
|
|
platforms = lib.platforms.linux;
|
|
};
|
|
}
|