mpvScripts.sponsorblock: Refactor with buildLua

This commit is contained in:
nicoo 2023-10-22 17:40:22 +00:00
parent 508d5ce83f
commit 8e5f764d6e

View file

@ -1,7 +1,7 @@
{ lib, stdenvNoCC, fetchFromGitHub, fetchpatch, python3, nix-update-script }: { lib, buildLua, fetchFromGitHub, fetchpatch, python3, nix-update-script }:
# Usage: `pkgs.mpv.override { scripts = [ pkgs.mpvScripts.sponsorblock ]; }` # Usage: `pkgs.mpv.override { scripts = [ pkgs.mpvScripts.sponsorblock ]; }`
stdenvNoCC.mkDerivation { buildLua {
pname = "mpv_sponsorblock"; pname = "mpv_sponsorblock";
version = "unstable-2023-01-30"; version = "unstable-2023-01-30";
@ -12,8 +12,6 @@ stdenvNoCC.mkDerivation {
sha256 = "sha256-iUXaTWWFEdxhxClu2NYbQcThlvYty3A2dEYGooeAVAQ="; sha256 = "sha256-iUXaTWWFEdxhxClu2NYbQcThlvYty3A2dEYGooeAVAQ=";
}; };
dontBuild = true;
patches = [ patches = [
# Use XDG_DATA_HOME and XDG_CACHE_HOME if defined for UID and DB # Use XDG_DATA_HOME and XDG_CACHE_HOME if defined for UID and DB
# Necessary to avoid sponsorblock to write in the nix store at runtime. # Necessary to avoid sponsorblock to write in the nix store at runtime.
@ -34,23 +32,16 @@ stdenvNoCC.mkDerivation {
--replace 'mp.find_config_file("scripts")' "\"$out/share/mpv/scripts\"" --replace 'mp.find_config_file("scripts")' "\"$out/share/mpv/scripts\""
''; '';
installPhase = '' postInstall = "cp -a sponsorblock_shared $out/share/mpv/scripts/";
mkdir -p $out/share/mpv/scripts
cp -r sponsorblock.lua sponsorblock_shared $out/share/mpv/scripts/
'';
passthru = { passthru.updateScript = nix-update-script {
scriptName = "sponsorblock.lua";
updateScript = nix-update-script {
extraArgs = [ "--version=branch" ]; extraArgs = [ "--version=branch" ];
}; };
};
meta = with lib; { meta = with lib; {
description = "Script for mpv to skip sponsored segments of YouTube videos"; description = "Script for mpv to skip sponsored segments of YouTube videos";
homepage = "https://github.com/po5/mpv_sponsorblock"; homepage = "https://github.com/po5/mpv_sponsorblock";
license = licenses.gpl3; license = licenses.gpl3;
platforms = platforms.all;
maintainers = with maintainers; [ pacien ]; maintainers = with maintainers; [ pacien ];
}; };
} }