biglybt: 3.5.0.0 -> 3.6.0.0
[NixPkgs.git] / pkgs / applications / video / mpv / scripts / webtorrent-mpv-hook.nix
blob10fe3d0cdce036b067745711b8d93d0fa54d9e8f
1 { lib, buildNpmPackage, fetchFromGitHub, gitUpdater, nodejs, python3 }:
3 buildNpmPackage rec {
4   pname = "webtorrent-mpv-hook";
5   version = "1.4.1";
7   src = fetchFromGitHub {
8     owner = "mrxdst";
9     repo = pname;
10     rev = "v${version}";
11     hash = "sha256-/dMtXcIyfAs++Zgz2CxRW0tkzn5QjS+WVGChlCyrU0U=";
12   };
13   passthru.updateScript = gitUpdater {
14     rev-prefix = "v";
15   };
17   postPatch = ''
18     substituteInPlace src/webtorrent.ts --replace "node_path: 'node'" "node_path: '${nodejs}/bin/node'"
19     # This executable is just for telling non-Nix users how to install
20     substituteInPlace package.json --replace '"bin": "build/bin.mjs",' ""
21     rm -rf src/bin.ts
22   '';
24   npmDepsHash = "sha256-EqHPBoYyBuW9elxQH/XVTZoPkKHC6+7aksYo60t7WA4=";
25   makeCacheWritable = true;
27   nativeBuildInputs = [
28     python3 # Fixes node-gyp on aarch64-linux
29   ];
31   postInstall = ''
32     mkdir -p $out/share/mpv/scripts/
33     ln -s $out/lib/node_modules/webtorrent-mpv-hook/build/webtorrent.js $out/share/mpv/scripts/
34   '';
35   passthru.scriptName = "webtorrent.js";
37   meta = {
38     description = "Adds a hook that allows mpv to stream torrents";
39     homepage = "https://github.com/mrxdst/webtorrent-mpv-hook";
40     maintainers = [ lib.maintainers.chuangzhu ];
41     license = lib.licenses.isc;
42   };