Skip to content

Commit

Permalink
Merge pull request #245562 from PedroHLC/fx_cast_bridge/buildNpmPackage
Browse files Browse the repository at this point in the history
fx_cast_bridge: adopt buildNpmPackage; rename to fx-cast-bridge
  • Loading branch information
dotlambda committed Jul 28, 2023
2 parents 66ce081 + 1a357a9 commit 857df77
Show file tree
Hide file tree
Showing 9 changed files with 59 additions and 6,785 deletions.
4 changes: 2 additions & 2 deletions pkgs/applications/networking/browsers/firefox/wrapper.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
, gnome/*.gnome-shell*/
, browserpass, gnome-browser-connector, uget-integrator, plasma5Packages, bukubrow, pipewire
, tridactyl-native
, fx_cast_bridge
, fx-cast-bridge
, udev
, libkrb5
, libva
Expand Down Expand Up @@ -69,7 +69,7 @@ let
++ lib.optional (cfg.enableGnomeExtensions or false) gnome-browser-connector
++ lib.optional (cfg.enableUgetIntegrator or false) uget-integrator
++ lib.optional (cfg.enablePlasmaBrowserIntegration or false) plasma5Packages.plasma-browser-integration
++ lib.optional (cfg.enableFXCastBridge or false) fx_cast_bridge
++ lib.optional (cfg.enableFXCastBridge or false) fx-cast-bridge
++ extraNativeMessagingHosts
;
libs = lib.optionals stdenv.isLinux [ udev libva mesa libnotify xorg.libXScrnSaver cups pciutils ]
Expand Down
55 changes: 55 additions & 0 deletions pkgs/tools/misc/fx-cast-bridge/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{ lib, buildNpmPackage, fetchFromGitHub, avahi-compat, nodejs, python3 }:

buildNpmPackage rec {
pname = "fx-cast-bridge";
version = "0.3.1";

src = fetchFromGitHub {
owner = "hensm";
repo = "fx_cast";
rev = "v${version}";
hash = "sha256-hB4NVJW2exHoKsMp0CKzHerYgj8aR77rV+ZsCoWA1Dg=";
};
sourceRoot = "source/app";
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;
maintainers = with maintainers; [ dtzWill pedrohlc ];
};
}
66 changes: 0 additions & 66 deletions pkgs/tools/misc/fx_cast/default.nix

This file was deleted.

Loading

0 comments on commit 857df77

Please sign in to comment.