mpvScripts.webtorrent-mpv-hook: 1.4.1 -> 1.4.4 (#350461)


Co-authored-by: nicoo <nicoo@mur.at>

authored by Chuang Zhu nicoo and committed by GitHub 6b645ffb 22baf876

+70 -10
+70 -10
pkgs/applications/video/mpv/scripts/webtorrent-mpv-hook.nix
··· 3 buildNpmPackage, 4 fetchFromGitHub, 5 gitUpdater, 6 - nodejs_20, 7 - python3, 8 }: 9 10 buildNpmPackage rec { 11 pname = "webtorrent-mpv-hook"; 12 - version = "1.4.1"; 13 14 src = fetchFromGitHub { 15 owner = "mrxdst"; 16 repo = pname; 17 rev = "v${version}"; 18 - hash = "sha256-/dMtXcIyfAs++Zgz2CxRW0tkzn5QjS+WVGChlCyrU0U="; 19 }; 20 passthru.updateScript = gitUpdater { rev-prefix = "v"; }; 21 22 postPatch = '' 23 - substituteInPlace src/webtorrent.ts --replace-fail "node_path: 'node'" "node_path: '${lib.getExe nodejs_20}'" 24 # This executable is just for telling non-Nix users how to install 25 substituteInPlace package.json --replace-fail '"bin": "build/bin.mjs",' "" 26 rm -rf src/bin.ts 27 ''; 28 29 - npmDepsHash = "sha256-EqHPBoYyBuW9elxQH/XVTZoPkKHC6+7aksYo60t7WA4="; 30 makeCacheWritable = true; 31 - 32 - nativeBuildInputs = [ 33 - python3 # Fixes node-gyp on aarch64-linux 34 - ]; 35 36 postInstall = '' 37 mkdir -p $out/share/mpv/scripts/ 38 ln -s $out/lib/node_modules/webtorrent-mpv-hook/build/webtorrent.js $out/share/mpv/scripts/
··· 3 buildNpmPackage, 4 fetchFromGitHub, 5 gitUpdater, 6 + nodejs, 7 + cmake, 8 + pkg-config, 9 + openssl, 10 + libdatachannel, 11 + plog, 12 }: 13 14 + let 15 + # Modified from pkgs/by-name/ht/httptoolkit-server/package.nix 16 + nodeDatachannel = buildNpmPackage { 17 + pname = "node-datachannel"; 18 + version = "0.10.1"; 19 + 20 + src = fetchFromGitHub { 21 + owner = "murat-dogan"; 22 + repo = "node-datachannel"; 23 + rev = "refs/tags/v${nodeDatachannel.version}"; 24 + hash = "sha256-r5tBg645ikIWm+RU7Muw/JYyd7AMpkImD0Xygtm1MUk="; 25 + }; 26 + 27 + npmFlags = [ "--ignore-scripts" ]; 28 + 29 + makeCacheWritable = true; 30 + 31 + npmDepsHash = "sha256-1ZJd0Y45B3CT2YPXDYfCuFMBo5uggWRuDH11eCobyyY="; 32 + 33 + nativeBuildInputs = [ 34 + cmake 35 + pkg-config 36 + ]; 37 + 38 + buildInputs = [ 39 + openssl 40 + libdatachannel 41 + plog 42 + ]; 43 + 44 + dontUseCmakeConfigure = true; 45 + 46 + env.NIX_CFLAGS_COMPILE = "-I${nodejs}/include/node"; 47 + 48 + preBuild = '' 49 + # don't use static libs and don't use FetchContent 50 + substituteInPlace CMakeLists.txt \ 51 + --replace-fail 'OPENSSL_USE_STATIC_LIBS TRUE' 'OPENSSL_USE_STATIC_LIBS FALSE' \ 52 + --replace-fail 'if(NOT libdatachannel)' 'if(false)' \ 53 + --replace-fail 'datachannel-static' 'datachannel' 54 + sed -i '2ifind_package(plog)' CMakeLists.txt 55 + 56 + # don't fetch node headers 57 + substituteInPlace node_modules/cmake-js/lib/dist.js \ 58 + --replace-fail '!this.downloaded' 'false' 59 + ''; 60 + 61 + installPhase = '' 62 + runHook preInstall 63 + install -Dm755 build/Release/*.node -t $out/build/Release 64 + runHook postInstall 65 + ''; 66 + }; 67 + in 68 + 69 buildNpmPackage rec { 70 pname = "webtorrent-mpv-hook"; 71 + version = "1.4.4"; 72 73 src = fetchFromGitHub { 74 owner = "mrxdst"; 75 repo = pname; 76 rev = "v${version}"; 77 + hash = "sha256-qFeQBVPZZFKkxz1fhK3+ah3TPDovklhhQwtv09TiSqo="; 78 }; 79 passthru.updateScript = gitUpdater { rev-prefix = "v"; }; 80 81 postPatch = '' 82 + substituteInPlace src/webtorrent.ts --replace-fail "node_path: 'node'" "node_path: '${lib.getExe nodejs}'" 83 # This executable is just for telling non-Nix users how to install 84 substituteInPlace package.json --replace-fail '"bin": "build/bin.mjs",' "" 85 rm -rf src/bin.ts 86 ''; 87 88 + npmDepsHash = "sha256-fKzXdbtxC2+63/GZdvPOxvBpQ5rzgvfseigOgpP1n5I="; 89 makeCacheWritable = true; 90 + npmFlags = [ "--ignore-scripts" ]; 91 92 + postConfigure = '' 93 + # manually place our prebuilt `node-datachannel` binary into its place, since we used '--ignore-scripts' 94 + ln -s ${nodeDatachannel}/build node_modules/node-datachannel/build 95 + ''; 96 postInstall = '' 97 mkdir -p $out/share/mpv/scripts/ 98 ln -s $out/lib/node_modules/webtorrent-mpv-hook/build/webtorrent.js $out/share/mpv/scripts/