biglybt: 3.5.0.0 -> 3.6.0.0
[NixPkgs.git] / pkgs / applications / video / mpv / scripts / sponsorblock.nix
blob077b8f0590b28c243e49da1b88468027dbd07880
1 { lib, buildLua, fetchFromGitHub, fetchpatch, python3, nix-update-script }:
3 # Usage: `pkgs.mpv.override { scripts = [ pkgs.mpvScripts.sponsorblock ]; }`
4 buildLua {
5   pname = "mpv_sponsorblock";
6   version = "unstable-2023-01-30";
8   src = fetchFromGitHub {
9     owner = "po5";
10     repo = "mpv_sponsorblock";
11     rev = "7785c1477103f2fafabfd65fdcf28ef26e6d7f0d";
12     sha256 = "sha256-iUXaTWWFEdxhxClu2NYbQcThlvYty3A2dEYGooeAVAQ=";
13   };
15   patches = [
16     # Use XDG_DATA_HOME and XDG_CACHE_HOME if defined for UID and DB
17     # Necessary to avoid sponsorblock to write in the nix store at runtime.
18     # https://github.com/po5/mpv_sponsorblock/pull/17
19     (fetchpatch {
20       url = "https://github.com/po5/mpv_sponsorblock/pull/17/commits/e65b360a7d03a3430b4829e457a6670b2f617b09.patch";
21       sha256 = "00wv0pvbz0dz2ibka66zhl2jk0pil4pyv6ipjfz37i81q6szyhs5";
22     })
23     (fetchpatch {
24       url = "https://github.com/po5/mpv_sponsorblock/pull/17/commits/3832304d959205e99120a14c0560ed3c37104b08.patch";
25       sha256 = "149ffvn714n2m3mqs8mgrbs24bcr74kqfkx7wyql36ndhm88xd2z";
26     })
27   ];
29   postPatch = ''
30     substituteInPlace sponsorblock.lua \
31       --replace "python3" "${python3}/bin/python3" \
32       --replace 'mp.find_config_file("scripts")' "\"$out/share/mpv/scripts\""
33   '';
35   postInstall = "cp -a sponsorblock_shared $out/share/mpv/scripts/";
37   passthru.updateScript = nix-update-script {
38     extraArgs = [ "--version=branch" ];
39   };
41   meta = with lib; {
42     description = "Script for mpv to skip sponsored segments of YouTube videos";
43     homepage = "https://github.com/po5/mpv_sponsorblock";
44     license = licenses.gpl3;
45     maintainers = with maintainers; [ pacien ];
46   };