2021-05-20 23:08:51 +00:00
|
|
|
# How to generate a new version:
|
|
|
|
#
|
|
|
|
# Update version and hash as usual.
|
|
|
|
#
|
|
|
|
# ```
|
2022-06-16 17:23:12 +00:00
|
|
|
# git clone https://github.com/hensm/fx_cast.git
|
2021-05-20 23:08:51 +00:00
|
|
|
# cd fx_cast/app
|
|
|
|
# # Add `"name": "fx_cast_bridge", "version": "...",` to package.json and package-lock.json
|
2022-06-16 17:23:12 +00:00
|
|
|
# nix run nixpkgs#nodePackages.node2nix -- -c node2nix -l package-lock.json -d
|
|
|
|
# cp -v node-*.nix package*.json ${nixpkgs_path:?}/pkgs/tools/misc/fx_cast/
|
2021-05-20 23:08:51 +00:00
|
|
|
# ```
|
2021-10-28 06:52:43 +00:00
|
|
|
{ pkgs, stdenv }: let
|
2021-05-20 23:08:51 +00:00
|
|
|
nodeEnv = import ./node-env.nix {
|
2022-06-16 17:23:12 +00:00
|
|
|
inherit (pkgs) nodejs stdenv lib python2 runCommand writeTextFile writeShellScript;
|
2021-05-20 23:08:51 +00:00
|
|
|
inherit pkgs;
|
|
|
|
libtool = if stdenv.isDarwin then pkgs.darwin.cctools else null;
|
|
|
|
};
|
|
|
|
nodePackages = import ./node-packages.nix {
|
|
|
|
inherit (pkgs) fetchurl nix-gitignore stdenv lib fetchgit;
|
|
|
|
inherit nodeEnv;
|
|
|
|
globalBuildInputs = [pkgs.avahi-compat];
|
|
|
|
};
|
|
|
|
in
|
2020-04-24 23:36:52 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2021-12-06 16:07:01 +00:00
|
|
|
pname = "fx_cast_bridge";
|
2022-06-16 17:23:12 +00:00
|
|
|
version = "0.2.0";
|
2021-05-20 23:08:51 +00:00
|
|
|
|
|
|
|
src = pkgs.fetchFromGitHub {
|
|
|
|
owner = "hensm";
|
|
|
|
repo = "fx_cast";
|
|
|
|
rev = "v${version}";
|
2022-06-16 17:23:12 +00:00
|
|
|
hash = "sha256-bgoItAOIHxGow7TjlRzaMqtIefcSym1h5n6v/9fFZfc=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-05-20 23:08:51 +00:00
|
|
|
buildInputs = with pkgs; [
|
|
|
|
nodejs
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-05-20 23:08:51 +00:00
|
|
|
buildPhase = ''
|
|
|
|
ln -vs ${nodePackages.nodeDependencies}/lib/node_modules app/node_modules
|
2022-06-16 17:23:12 +00:00
|
|
|
# The temporary home solves the "failed with exit code 243"
|
|
|
|
HOME="$(mktemp -d)" npm run build:app
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
2021-05-20 23:08:51 +00:00
|
|
|
mkdir -p $out/bin $out/lib/mozilla/native-messaging-hosts $out/opt
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-05-20 23:08:51 +00:00
|
|
|
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
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-05-20 23:08:51 +00:00
|
|
|
echo "#! /bin/sh
|
|
|
|
NODE_PATH=${nodePackages.nodeDependencies}/lib/node_modules exec ${pkgs.nodejs}/bin/node $out/opt/fx_cast_bridge/src/main.js --_name fx_cast_bridge \"\$@\"
|
|
|
|
" >$out/bin/fx_cast_bridge
|
|
|
|
chmod +x $out/bin/fx_cast_bridge
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-05-20 23:08:51 +00:00
|
|
|
mv dist/app $out/opt/fx_cast_bridge
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2021-05-20 23:08:51 +00:00
|
|
|
meta = with pkgs.lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Implementation of the Chrome Sender API (Chromecast) within Firefox";
|
|
|
|
homepage = "https://hensm.github.io/fx_cast/";
|
|
|
|
license = licenses.mit;
|
2021-05-20 23:08:51 +00:00
|
|
|
maintainers = with maintainers; [ dtzWill kevincox ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|