mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-28 08:33:54 +00:00
41 lines
1.2 KiB
Nix
41 lines
1.2 KiB
Nix
{ lib, buildNpmPackage, fetchFromGitHub, nodejs, python3 }:
|
|
|
|
buildNpmPackage rec {
|
|
pname = "webtorrent-mpv-hook";
|
|
version = "1.3.3";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "mrxdst";
|
|
repo = pname;
|
|
rev = "v${version}";
|
|
hash = "sha256-AFKX31kriacXygZy0Mw+QwO+SwFEu13687mJ/WeAoKY=";
|
|
};
|
|
|
|
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.js",' ""
|
|
rm -rf src/bin.ts
|
|
'';
|
|
|
|
npmDepsHash = "sha256-GpNUJ5ZCgMjSYLqsIE/RwkTSFT3uAhxrHPe7XvGDRHE=";
|
|
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;
|
|
};
|
|
}
|