2023-12-12 14:41:39 +00:00
|
|
|
{ lib, buildNpmPackage, fetchFromGitHub, avahi-compat, nodejs_18, python3 }:
|
2023-07-26 17:22:34 +00:00
|
|
|
|
|
|
|
buildNpmPackage rec {
|
|
|
|
pname = "fx-cast-bridge";
|
|
|
|
version = "0.3.1";
|
|
|
|
|
2023-12-12 14:41:39 +00:00
|
|
|
nodejs = nodejs_18;
|
|
|
|
|
2023-07-26 17:22:34 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "hensm";
|
|
|
|
repo = "fx_cast";
|
|
|
|
rev = "v${version}";
|
|
|
|
hash = "sha256-hB4NVJW2exHoKsMp0CKzHerYgj8aR77rV+ZsCoWA1Dg=";
|
|
|
|
};
|
2023-08-11 19:39:00 +00:00
|
|
|
sourceRoot = "${src.name}/app";
|
2023-07-26 17:22:34 +00:00
|
|
|
npmDepsHash = "sha256-GLrDRZqKcX1PDGREx+MLZ1TEjr88r9nz4TvZ9nvo40g=";
|
|
|
|
|
|
|
|
nativeBuildInputs = [ python3 ];
|
|
|
|
buildInputs = [ avahi-compat ];
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace bin/lib/paths.js \
|
|
|
|
--replace "../../../" "../../"
|
|
|
|
'';
|
|
|
|
|
|
|
|
dontNpmInstall = true;
|
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
|
|
|
|
mkdir -p $out/{bin,lib/mozilla/native-messaging-hosts}
|
|
|
|
|
|
|
|
substituteInPlace dist/app/fx_cast_bridge.json \
|
|
|
|
--replace "$(realpath dist/app/fx_cast_bridge.sh)" "$out/bin/fx_cast_bridge"
|
|
|
|
mv dist/app/fx_cast_bridge.json $out/lib/mozilla/native-messaging-hosts
|
|
|
|
|
|
|
|
rm dist/app/fx_cast_bridge.sh
|
|
|
|
mv dist/app $out/lib/fx_cast_bridge
|
|
|
|
mv node_modules $out/lib/fx_cast_bridge/node_modules
|
|
|
|
|
|
|
|
echo "#! /bin/sh
|
|
|
|
NODE_PATH=\"$out/lib/node_modules\" \\
|
|
|
|
exec ${nodejs}/bin/node \\
|
|
|
|
$out/lib/fx_cast_bridge/src/main.js \\
|
|
|
|
--_name fx_cast_bridge \"\$@\"
|
|
|
|
" >$out/bin/fx_cast_bridge
|
|
|
|
chmod +x $out/bin/fx_cast_bridge
|
|
|
|
|
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Implementation of the Chrome Sender API (Chromecast) within Firefox";
|
|
|
|
homepage = "https://hensm.github.io/fx_cast/";
|
|
|
|
license = licenses.mit;
|
2024-07-28 14:44:11 +00:00
|
|
|
maintainers = [ ];
|
2023-11-27 01:17:53 +00:00
|
|
|
mainProgram = "fx_cast_bridge";
|
2023-07-26 17:22:34 +00:00
|
|
|
};
|
|
|
|
}
|