Merge pull request #265676 from nbraud/mpvScripts/refactor
This commit is contained in:
commit
2a4751dc3f
6 changed files with 51 additions and 57 deletions
|
@ -1,27 +1,17 @@
|
||||||
{ stdenvNoCC
|
{ lib
|
||||||
|
, buildLua
|
||||||
, mpv-unwrapped
|
, mpv-unwrapped
|
||||||
, lib
|
|
||||||
}:
|
}:
|
||||||
|
|
||||||
stdenvNoCC.mkDerivation rec {
|
buildLua {
|
||||||
|
inherit (mpv-unwrapped) src version;
|
||||||
pname = "mpv-acompressor";
|
pname = "mpv-acompressor";
|
||||||
version = mpv-unwrapped.version;
|
scriptPath = "TOOLS/lua/acompressor.lua";
|
||||||
|
|
||||||
src = "${mpv-unwrapped.src.outPath}/TOOLS/lua/acompressor.lua";
|
|
||||||
|
|
||||||
dontBuild = true;
|
|
||||||
dontUnpack = true;
|
|
||||||
|
|
||||||
installPhase = ''
|
|
||||||
install -Dm644 ${src} $out/share/mpv/scripts/acompressor.lua
|
|
||||||
'';
|
|
||||||
|
|
||||||
passthru.scriptName = "acompressor.lua";
|
|
||||||
|
|
||||||
meta = with lib; {
|
meta = with lib; {
|
||||||
|
inherit (mpv-unwrapped.meta) license;
|
||||||
description = "Script to toggle and control ffmpeg's dynamic range compression filter.";
|
description = "Script to toggle and control ffmpeg's dynamic range compression filter.";
|
||||||
homepage = "https://github.com/mpv-player/mpv/blob/master/TOOLS/lua/acompressor.lua";
|
homepage = "https://github.com/mpv-player/mpv/blob/master/TOOLS/lua/acompressor.lua";
|
||||||
license = licenses.gpl2Plus;
|
|
||||||
maintainers = with maintainers; [ nicoo ];
|
maintainers = with maintainers; [ nicoo ];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
22
pkgs/applications/video/mpv/scripts/buildLua.nix
Normal file
22
pkgs/applications/video/mpv/scripts/buildLua.nix
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
{ lib
|
||||||
|
, stdenvNoCC }:
|
||||||
|
|
||||||
|
let fileName = pathStr: lib.last (lib.splitString "/" pathStr);
|
||||||
|
in
|
||||||
|
lib.makeOverridable (
|
||||||
|
{ pname, scriptPath ? "${pname}.lua", ... }@args:
|
||||||
|
stdenvNoCC.mkDerivation (lib.attrsets.recursiveUpdate {
|
||||||
|
dontBuild = true;
|
||||||
|
preferLocalBuild = true;
|
||||||
|
|
||||||
|
outputHashMode = "recursive";
|
||||||
|
installPhase = ''
|
||||||
|
runHook preInstall
|
||||||
|
install -m644 -Dt $out/share/mpv/scripts ${scriptPath}
|
||||||
|
runHook postInstall
|
||||||
|
'';
|
||||||
|
|
||||||
|
passthru.scriptName = fileName scriptPath;
|
||||||
|
meta.platforms = lib.platforms.all;
|
||||||
|
} args)
|
||||||
|
)
|
|
@ -1,11 +1,9 @@
|
||||||
{ lib
|
{ lib
|
||||||
, fetchFromGitHub
|
, fetchFromGitHub
|
||||||
, nix-update-script
|
, buildLua }:
|
||||||
, stdenvNoCC }:
|
|
||||||
|
|
||||||
stdenvNoCC.mkDerivation {
|
buildLua {
|
||||||
pname = "chapterskip";
|
pname = "chapterskip";
|
||||||
passthru.scriptName = "chapterskip.lua";
|
|
||||||
|
|
||||||
version = "unstable-2022-09-08";
|
version = "unstable-2022-09-08";
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
|
@ -15,17 +13,8 @@ stdenvNoCC.mkDerivation {
|
||||||
hash = "sha256-OTrLQE3rYvPQamEX23D6HttNjx3vafWdTMxTiWpDy90=";
|
hash = "sha256-OTrLQE3rYvPQamEX23D6HttNjx3vafWdTMxTiWpDy90=";
|
||||||
};
|
};
|
||||||
|
|
||||||
dontBuild = true;
|
meta = {
|
||||||
preferLocalBuild = true;
|
|
||||||
installPhase = "install -Dt $out/share/mpv/scripts chapterskip.lua";
|
|
||||||
|
|
||||||
passthru.updateScript = nix-update-script {
|
|
||||||
extraArgs = [ "--version=branch" ];
|
|
||||||
};
|
|
||||||
|
|
||||||
meta = with lib; {
|
|
||||||
homepage = "https://github.com/po5/chapterskip";
|
homepage = "https://github.com/po5/chapterskip";
|
||||||
platforms = platforms.all;
|
maintainers = with lib.maintainers; [ nicoo ];
|
||||||
maintainers = with maintainers; [ nicoo ];
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,13 +3,14 @@
|
||||||
, config
|
, config
|
||||||
}:
|
}:
|
||||||
|
|
||||||
lib.recurseIntoAttrs
|
let buildLua = callPackage ./buildLua.nix { };
|
||||||
|
in lib.recurseIntoAttrs
|
||||||
({
|
({
|
||||||
acompressor = callPackage ./acompressor.nix { };
|
acompressor = callPackage ./acompressor.nix { inherit buildLua; };
|
||||||
autocrop = callPackage ./autocrop.nix { };
|
autocrop = callPackage ./autocrop.nix { };
|
||||||
autodeint = callPackage ./autodeint.nix { };
|
autodeint = callPackage ./autodeint.nix { };
|
||||||
autoload = callPackage ./autoload.nix { };
|
autoload = callPackage ./autoload.nix { };
|
||||||
chapterskip = callPackage ./chapterskip.nix { };
|
chapterskip = callPackage ./chapterskip.nix { inherit buildLua; };
|
||||||
convert = callPackage ./convert.nix { };
|
convert = callPackage ./convert.nix { };
|
||||||
inhibit-gnome = callPackage ./inhibit-gnome.nix { };
|
inhibit-gnome = callPackage ./inhibit-gnome.nix { };
|
||||||
mpris = callPackage ./mpris.nix { };
|
mpris = callPackage ./mpris.nix { };
|
||||||
|
@ -27,7 +28,7 @@ lib.recurseIntoAttrs
|
||||||
webtorrent-mpv-hook = callPackage ./webtorrent-mpv-hook.nix { };
|
webtorrent-mpv-hook = callPackage ./webtorrent-mpv-hook.nix { };
|
||||||
cutter = callPackage ./cutter.nix { };
|
cutter = callPackage ./cutter.nix { };
|
||||||
}
|
}
|
||||||
// (callPackage ./occivink.nix { }))
|
// (callPackage ./occivink.nix { inherit buildLua; }))
|
||||||
// lib.optionalAttrs config.allowAliases {
|
// lib.optionalAttrs config.allowAliases {
|
||||||
youtube-quality = throw "'youtube-quality' is no longer maintained, use 'quality-menu' instead"; # added 2023-07-14
|
youtube-quality = throw "'youtube-quality' is no longer maintained, use 'quality-menu' instead"; # added 2023-07-14
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,17 @@
|
||||||
{ lib
|
{ lib
|
||||||
, stdenvNoCC
|
|
||||||
, fetchFromGitHub
|
, fetchFromGitHub
|
||||||
|
, buildLua
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
script = { n, ... }@p:
|
camelToKebab = let
|
||||||
stdenvNoCC.mkDerivation (lib.attrsets.recursiveUpdate {
|
inherit (lib.strings) match stringAsChars toLower;
|
||||||
pname = "mpv_${n}";
|
isUpper = match "[A-Z]";
|
||||||
passthru.scriptName = "${n}.lua";
|
in stringAsChars (c: if isUpper c != null then "-${toLower c}" else c);
|
||||||
|
|
||||||
|
mkScript = name: args:
|
||||||
|
buildLua (lib.attrsets.recursiveUpdate rec {
|
||||||
|
pname = camelToKebab name;
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
owner = "occivink";
|
owner = "occivink";
|
||||||
repo = "mpv-scripts";
|
repo = "mpv-scripts";
|
||||||
|
@ -17,37 +20,26 @@ let
|
||||||
};
|
};
|
||||||
version = "unstable-2022-10-02";
|
version = "unstable-2022-10-02";
|
||||||
|
|
||||||
dontBuild = true;
|
scriptPath = "scripts/${pname}.lua";
|
||||||
installPhase = ''
|
|
||||||
mkdir -p $out/share/mpv/scripts
|
|
||||||
cp -r scripts/${n}.lua $out/share/mpv/scripts/
|
|
||||||
'';
|
|
||||||
|
|
||||||
meta = with lib; {
|
meta = with lib; {
|
||||||
homepage = "https://github.com/occivink/mpv-scripts";
|
homepage = "https://github.com/occivink/mpv-scripts";
|
||||||
license = licenses.unlicense;
|
license = licenses.unlicense;
|
||||||
platforms = platforms.all;
|
|
||||||
maintainers = with maintainers; [ nicoo ];
|
maintainers = with maintainers; [ nicoo ];
|
||||||
};
|
};
|
||||||
|
} args);
|
||||||
outputHashAlgo = "sha256";
|
|
||||||
outputHashMode = "recursive";
|
|
||||||
} p);
|
|
||||||
|
|
||||||
in
|
in
|
||||||
{
|
lib.mapAttrs (name: lib.makeOverridable (mkScript name)) {
|
||||||
|
|
||||||
# Usage: `pkgs.mpv.override { scripts = [ pkgs.mpvScripts.seekTo ]; }`
|
# Usage: `pkgs.mpv.override { scripts = [ pkgs.mpvScripts.seekTo ]; }`
|
||||||
seekTo = script {
|
seekTo = {
|
||||||
n = "seek-to";
|
|
||||||
meta.description = "Mpv script for seeking to a specific position";
|
meta.description = "Mpv script for seeking to a specific position";
|
||||||
outputHash = "sha256-3RlbtUivmeoR9TZ6rABiZSd5jd2lFv/8p/4irHMLshs=";
|
outputHash = "sha256-3RlbtUivmeoR9TZ6rABiZSd5jd2lFv/8p/4irHMLshs=";
|
||||||
};
|
};
|
||||||
|
|
||||||
blacklistExtensions = script {
|
blacklistExtensions = {
|
||||||
n = "blacklist-extensions";
|
|
||||||
meta.description = "Automatically remove playlist entries based on their extension.";
|
meta.description = "Automatically remove playlist entries based on their extension.";
|
||||||
outputHash = "sha256-qw9lz8ofmvvh23F9aWLxiU4YofY+YflRETu+nxMhvVE=";
|
outputHash = "sha256-qw9lz8ofmvvh23F9aWLxiU4YofY+YflRETu+nxMhvVE=";
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -33935,7 +33935,7 @@ with pkgs;
|
||||||
wlroots = wlroots_0_15;
|
wlroots = wlroots_0_15;
|
||||||
};
|
};
|
||||||
|
|
||||||
mpvScripts = import ../applications/video/mpv/scripts { inherit lib callPackage config; };
|
mpvScripts = callPackage ../applications/video/mpv/scripts { };
|
||||||
|
|
||||||
open-in-mpv = callPackage ../applications/video/open-in-mpv { };
|
open-in-mpv = callPackage ../applications/video/open-in-mpv { };
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue