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 ]; }`
stdenvNoCC.mkDerivation {
buildLua {
pname = "mpv_sponsorblock";
version = "unstable-2023-01-30";
@ -12,8 +12,6 @@ stdenvNoCC.mkDerivation {
sha256 = "sha256-iUXaTWWFEdxhxClu2NYbQcThlvYty3A2dEYGooeAVAQ=";
};
dontBuild = true;
patches = [
# 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.
@ -34,23 +32,16 @@ stdenvNoCC.mkDerivation {
--replace 'mp.find_config_file("scripts")' "\"$out/share/mpv/scripts\""
'';
installPhase = ''
mkdir -p $out/share/mpv/scripts
cp -r sponsorblock.lua sponsorblock_shared $out/share/mpv/scripts/
'';
postInstall = "cp -a sponsorblock_shared $out/share/mpv/scripts/";
passthru = {
scriptName = "sponsorblock.lua";
updateScript = nix-update-script {
extraArgs = [ "--version=branch" ];
};
passthru.updateScript = nix-update-script {
extraArgs = [ "--version=branch" ];
};
meta = with lib; {
description = "Script for mpv to skip sponsored segments of YouTube videos";
homepage = "https://github.com/po5/mpv_sponsorblock";
license = licenses.gpl3;
platforms = platforms.all;
maintainers = with maintainers; [ pacien ];
};
}