2023-07-15 17:15:38 +00:00
|
|
|
{ lib
|
|
|
|
, fetchFromGitHub
|
2024-01-02 11:29:13 +00:00
|
|
|
, unstableGitUpdater
|
2023-11-16 04:20:00 +00:00
|
|
|
, buildLua
|
2023-07-15 17:15:38 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
2023-11-16 04:20:00 +00:00
|
|
|
camelToKebab = let
|
|
|
|
inherit (lib.strings) match stringAsChars toLower;
|
|
|
|
isUpper = match "[A-Z]";
|
|
|
|
in stringAsChars (c: if isUpper c != null then "-${toLower c}" else c);
|
|
|
|
|
|
|
|
mkScript = name: args:
|
2024-01-02 11:29:13 +00:00
|
|
|
let self = rec {
|
2023-11-16 04:20:00 +00:00
|
|
|
pname = camelToKebab name;
|
2024-01-02 11:29:13 +00:00
|
|
|
version = "unstable-2023-12-18";
|
2023-07-15 17:15:38 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "occivink";
|
|
|
|
repo = "mpv-scripts";
|
2024-01-02 11:29:13 +00:00
|
|
|
rev = "f0426bd6b107b1f4b124552dae923b62f58ce3b6";
|
|
|
|
hash = "sha256-oag5lcDoezyNXs5EBr0r0UE3ikeftvbfxSzfbxV1Oy0=";
|
2023-07-15 17:15:38 +00:00
|
|
|
};
|
2024-01-02 11:29:13 +00:00
|
|
|
passthru.updateScript = unstableGitUpdater {};
|
2023-07-15 17:15:38 +00:00
|
|
|
|
2023-11-16 04:20:00 +00:00
|
|
|
scriptPath = "scripts/${pname}.lua";
|
2023-07-15 17:15:38 +00:00
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
homepage = "https://github.com/occivink/mpv-scripts";
|
|
|
|
license = licenses.unlicense;
|
|
|
|
maintainers = with maintainers; [ nicoo ];
|
|
|
|
};
|
2024-01-02 11:29:13 +00:00
|
|
|
|
|
|
|
# Sadly needed to make `common-updaters` work here
|
|
|
|
pos = builtins.unsafeGetAttrPos "version" self;
|
|
|
|
};
|
|
|
|
in buildLua (lib.attrsets.recursiveUpdate self args);
|
2023-07-15 17:15:38 +00:00
|
|
|
|
|
|
|
in
|
2023-11-16 04:20:00 +00:00
|
|
|
lib.mapAttrs (name: lib.makeOverridable (mkScript name)) {
|
2023-07-15 17:15:38 +00:00
|
|
|
|
|
|
|
# Usage: `pkgs.mpv.override { scripts = [ pkgs.mpvScripts.seekTo ]; }`
|
2024-01-02 11:29:13 +00:00
|
|
|
seekTo.meta.description = "Mpv script for seeking to a specific position";
|
|
|
|
blacklistExtensions.meta.description =
|
|
|
|
"Automatically remove playlist entries based on their extension.";
|
2023-07-15 17:15:38 +00:00
|
|
|
}
|