1 { lib, buildNpmPackage, fetchFromGitHub, gitUpdater, nodejs, python3 }:
4 pname = "webtorrent-mpv-hook";
7 src = fetchFromGitHub {
11 hash = "sha256-/dMtXcIyfAs++Zgz2CxRW0tkzn5QjS+WVGChlCyrU0U=";
13 passthru.updateScript = gitUpdater {
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",' ""
24 npmDepsHash = "sha256-EqHPBoYyBuW9elxQH/XVTZoPkKHC6+7aksYo60t7WA4=";
25 makeCacheWritable = true;
28 python3 # Fixes node-gyp on aarch64-linux
32 mkdir -p $out/share/mpv/scripts/
33 ln -s $out/lib/node_modules/webtorrent-mpv-hook/build/webtorrent.js $out/share/mpv/scripts/
35 passthru.scriptName = "webtorrent.js";
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;