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