Merge pull request #270927 from nbraud/mpvScripts/sponsorblock

mpvScripts.sponsorblock: Simplify with `buildLua`
This commit is contained in:
Maciej Krüger 2023-12-31 14:03:46 +01:00 committed by GitHub
commit 2b97055f53
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 14 deletions

View File

@ -36,6 +36,9 @@ lib.makeOverridable (args: stdenvNoCC.mkDerivation (extendedBy
dontBuild = true;
preferLocalBuild = true;
# Prevent `patch` from emitting `.orig` files (that end up in the output)
patchFlags = [ "--no-backup-if-mismatch" "-p1" ];
outputHashMode = "recursive";
installPhase = ''
runHook preInstall

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 ];
};
}