summaryrefslogtreecommitdiffstats
path: root/pkgs/applications/video
diff options
context:
space:
mode:
authorDoron Behar <doron.behar@gmail.com>2023-01-28 17:58:26 +0200
committerGitHub <noreply@github.com>2023-01-28 17:58:26 +0200
commitff73f0aad2275e0cb2bc2b782407b05f4dbdaf2d (patch)
tree09f694e7d895828146593e3202ea7287e464159a /pkgs/applications/video
parent960bc19bca85f7c475be04d102f64aa5438e6437 (diff)
parent3d73774412d94d99f18c2fea720256a7cb40151a (diff)
Merge pull request #212989 from chuangzhu/webtorrent-mpv-hook
mpvScripts.webtorrent-mpv-hook: init at 1.3.3
Diffstat (limited to 'pkgs/applications/video')
-rw-r--r--pkgs/applications/video/mpv/scripts/webtorrent-mpv-hook.nix36
1 files changed, 36 insertions, 0 deletions
diff --git a/pkgs/applications/video/mpv/scripts/webtorrent-mpv-hook.nix b/pkgs/applications/video/mpv/scripts/webtorrent-mpv-hook.nix
new file mode 100644
index 000000000000..811b49e8714b
--- /dev/null
+++ b/pkgs/applications/video/mpv/scripts/webtorrent-mpv-hook.nix
@@ -0,0 +1,36 @@
+{ lib , buildNpmPackage , fetchFromGitHub, nodejs }:
+
+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;
+
+ 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;
+ };
+}