diff --git a/pkgs/applications/video/mpv/scripts.nix b/pkgs/applications/video/mpv/scripts.nix index 151674c8a958..ab1e5f334d5b 100644 --- a/pkgs/applications/video/mpv/scripts.nix +++ b/pkgs/applications/video/mpv/scripts.nix @@ -101,6 +101,10 @@ let autodeint autoload ; # added 2024-11-28 + inherit (self.eisa01) + smart-copy-paste-2 + smartskip + ; # added 2025-03-09 inherit (self.occivink) blacklistExtensions crop diff --git a/pkgs/applications/video/mpv/scripts/eisa01.nix b/pkgs/applications/video/mpv/scripts/eisa01.nix new file mode 100644 index 000000000000..38e6e4f50567 --- /dev/null +++ b/pkgs/applications/video/mpv/scripts/eisa01.nix @@ -0,0 +1,65 @@ +{ + lib, + fetchFromGitHub, + unstableGitUpdater, + buildLua, + xclip, +}: + +let + mkScript = + pname: args: + let + self = { + inherit pname; + version = "0-unstable-2023-11-25"; + + src = fetchFromGitHub { + owner = "Eisa01"; + repo = "mpv-scripts"; + rev = "48d68283cea47ff8e904decc9003b3abc3e2123e"; + hash = "sha256-edJfotlC5T8asqPIygR67BEWjP4i54Wx54StLfjpc48="; + # avoid downloading screenshots and videos + sparseCheckout = [ + "scripts/" + "script-opts/" + ]; + }; + passthru.updateScript = unstableGitUpdater { }; + + meta = with lib; { + homepage = "https://github.com/Eisa01/mpv-scripts"; + license = licenses.bsd2; + }; + + # Sadly needed to make `common-updaters` work here + pos = builtins.unsafeGetAttrPos "version" self; + }; + in + buildLua (lib.attrsets.recursiveUpdate self args); +in +lib.recurseIntoAttrs ( + lib.mapAttrs (name: lib.makeOverridable (mkScript name)) { + + # Usage: `pkgs.mpv.override { scripts = [ pkgs.mpvScripts.seekTo ]; }` + smart-copy-paste-2 = { + scriptPath = "scripts/SmartCopyPaste_II.lua"; + prePatch = '' + substituteInPlace $scriptPath --replace-fail 'xclip' "${lib.getExe xclip}" + ''; + + meta = { + description = "Smart copy paste with logging and clipboard support"; + maintainers = with lib.maintainers; [ luftmensch-luftmensch ]; + }; + }; + + smartskip = { + scriptPath = "scripts/SmartSkip.lua"; + meta = { + description = "Automatically or manually skip opening, intro, outro, and preview"; + maintainers = with lib.maintainers; [ iynaix ]; + }; + }; + } +) diff --git a/pkgs/applications/video/mpv/scripts/smart-copy-paste-2.nix b/pkgs/applications/video/mpv/scripts/smart-copy-paste-2.nix deleted file mode 100644 index dab4a7ddfcd9..000000000000 --- a/pkgs/applications/video/mpv/scripts/smart-copy-paste-2.nix +++ /dev/null @@ -1,33 +0,0 @@ -{ - lib, - buildLua, - fetchFromGitHub, - unstableGitUpdater, - xclip, -}: -buildLua (finalAttrs: { - pname = "smart-copy-paste-2"; - version = "0-unstable-2023-11-25"; - - scriptPath = "scripts/SmartCopyPaste_II.lua"; - src = fetchFromGitHub { - owner = "Eisa01"; - repo = "mpv-scripts"; - rev = "48d68283cea47ff8e904decc9003b3abc3e2123e"; - hash = "sha256-95CAKjBRELX2f7oWSHFWJnI0mikAoxhfUphe9k51Qf4="; - }; - - prePatch = '' - substituteInPlace scripts/SmartCopyPaste_II.lua \ - --replace-fail 'xclip' "${lib.getExe xclip}" - ''; - - passthru.updateScript = unstableGitUpdater { }; - - meta = with lib; { - description = "Smart copy paste with logging and clipboard support"; - homepage = "https://github.com/Eisa01/mpv-scripts"; - license = licenses.bsd2; - maintainers = with maintainers; [ luftmensch-luftmensch ]; - }; -}) diff --git a/pkgs/applications/video/mpv/scripts/smartskip.nix b/pkgs/applications/video/mpv/scripts/smartskip.nix deleted file mode 100644 index 505269847f08..000000000000 --- a/pkgs/applications/video/mpv/scripts/smartskip.nix +++ /dev/null @@ -1,28 +0,0 @@ -{ - lib, - fetchFromGitHub, - unstableGitUpdater, - buildLua, -}: - -buildLua { - pname = "smartskip"; - version = "0-unstable-2023-11-25"; - - scriptPath = "scripts/SmartSkip.lua"; - src = fetchFromGitHub { - owner = "Eisa01"; - repo = "mpv-scripts"; - rev = "48d68283cea47ff8e904decc9003b3abc3e2123e"; - hash = "sha256-95CAKjBRELX2f7oWSHFWJnI0mikAoxhfUphe9k51Qf4="; - }; - - passthru.updateScript = unstableGitUpdater { }; - - meta = { - description = "Automatically or manually skip opening, intro, outro, and preview"; - homepage = "https://github.com/Eisa01/mpv-scripts"; - license = lib.licenses.bsd2; - maintainers = [ lib.maintainers.iynaix ]; - }; -}