nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at 21.11 64 lines 2.0 kB view raw
1# How to generate a new version: 2# 3# Update version and hash as usual. 4# 5# ``` 6# cd fx_cast/app 7# # Add `"name": "fx_cast_bridge", "version": "...",` to package.json and package-lock.json 8# nix run nixpkgs.nodePackages.node2nix -c node2nix -l package-lock.json -d 9# cp -v node-*.nix package*.json ~/p/nixpkgs/pkgs/tools/misc/fx_cast/app 10# ``` 11{ pkgs, stdenv }: let 12 nodeEnv = import ./node-env.nix { 13 inherit (pkgs) nodejs stdenv lib python2 runCommand writeTextFile; 14 inherit pkgs; 15 libtool = if stdenv.isDarwin then pkgs.darwin.cctools else null; 16 }; 17 nodePackages = import ./node-packages.nix { 18 inherit (pkgs) fetchurl nix-gitignore stdenv lib fetchgit; 19 inherit nodeEnv; 20 globalBuildInputs = [pkgs.avahi-compat]; 21 }; 22in 23stdenv.mkDerivation rec { 24 name = "fx_cast_bridge-${version}"; 25 version = "0.1.2"; 26 27 src = pkgs.fetchFromGitHub { 28 owner = "hensm"; 29 repo = "fx_cast"; 30 rev = "v${version}"; 31 hash = "sha256:1prgk9669xgwkdl39clq0l75n0gnkkpn27gp9rbgl4bafrhvmg9a"; 32 }; 33 34 buildInputs = with pkgs; [ 35 nodejs 36 ]; 37 38 buildPhase = '' 39 ln -vs ${nodePackages.nodeDependencies}/lib/node_modules app/node_modules 40 npm run build:app 41 ''; 42 43 installPhase = '' 44 mkdir -p $out/bin $out/lib/mozilla/native-messaging-hosts $out/opt 45 46 substituteInPlace dist/app/fx_cast_bridge.json \ 47 --replace "$(realpath dist/app/fx_cast_bridge.sh)" "$out/bin/fx_cast_bridge" 48 mv dist/app/fx_cast_bridge.json $out/lib/mozilla/native-messaging-hosts 49 50 echo "#! /bin/sh 51 NODE_PATH=${nodePackages.nodeDependencies}/lib/node_modules exec ${pkgs.nodejs}/bin/node $out/opt/fx_cast_bridge/src/main.js --_name fx_cast_bridge \"\$@\" 52 " >$out/bin/fx_cast_bridge 53 chmod +x $out/bin/fx_cast_bridge 54 55 mv dist/app $out/opt/fx_cast_bridge 56 ''; 57 58 meta = with pkgs.lib; { 59 description = "Implementation of the Chrome Sender API (Chromecast) within Firefox"; 60 homepage = "https://hensm.github.io/fx_cast/"; 61 license = licenses.mit; 62 maintainers = with maintainers; [ dtzWill kevincox ]; 63 }; 64}