From cfb1af2bd9365380cee574d4e9729b72b6752f46 Mon Sep 17 00:00:00 2001 From: nicoo Date: Sun, 9 Mar 2025 18:07:45 +0000 Subject: [PATCH 1/2] mpvScripts: group `smartskip` and `smart-copy-paste-2` in a common attrset --- pkgs/applications/video/mpv/scripts.nix | 4 ++ .../applications/video/mpv/scripts/eisa01.nix | 60 +++++++++++++++++++ .../video/mpv/scripts/smart-copy-paste-2.nix | 33 ---------- .../video/mpv/scripts/smartskip.nix | 28 --------- 4 files changed, 64 insertions(+), 61 deletions(-) create mode 100644 pkgs/applications/video/mpv/scripts/eisa01.nix delete mode 100644 pkgs/applications/video/mpv/scripts/smart-copy-paste-2.nix delete mode 100644 pkgs/applications/video/mpv/scripts/smartskip.nix 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..6401ee71ab03 --- /dev/null +++ b/pkgs/applications/video/mpv/scripts/eisa01.nix @@ -0,0 +1,60 @@ +{ + 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-95CAKjBRELX2f7oWSHFWJnI0mikAoxhfUphe9k51Qf4="; + }; + 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 ]; - }; -} From b077ad8b89045c3fdd41c8e171f7f9ac9e298d7e Mon Sep 17 00:00:00 2001 From: nicoo Date: Sun, 9 Mar 2025 18:12:01 +0000 Subject: [PATCH 2/2] mpvScripts.eisa01: avoid downloading screenshots and videos --- pkgs/applications/video/mpv/scripts/eisa01.nix | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkgs/applications/video/mpv/scripts/eisa01.nix b/pkgs/applications/video/mpv/scripts/eisa01.nix index 6401ee71ab03..38e6e4f50567 100644 --- a/pkgs/applications/video/mpv/scripts/eisa01.nix +++ b/pkgs/applications/video/mpv/scripts/eisa01.nix @@ -18,7 +18,12 @@ let owner = "Eisa01"; repo = "mpv-scripts"; rev = "48d68283cea47ff8e904decc9003b3abc3e2123e"; - hash = "sha256-95CAKjBRELX2f7oWSHFWJnI0mikAoxhfUphe9k51Qf4="; + hash = "sha256-edJfotlC5T8asqPIygR67BEWjP4i54Wx54StLfjpc48="; + # avoid downloading screenshots and videos + sparseCheckout = [ + "scripts/" + "script-opts/" + ]; }; passthru.updateScript = unstableGitUpdater { };