tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
lol
0
fork
atom
overview
issues
pulls
pipelines
mpvScripts: refactor around `buildLua` helper
nicoo
2 years ago
a899b23b
3a2389bf
+40
-54
5 changed files
expand all
collapse all
unified
split
pkgs
applications
video
mpv
scripts
acompressor.nix
buildLua.nix
chapterskip.nix
default.nix
occivink.nix
+6
-16
pkgs/applications/video/mpv/scripts/acompressor.nix
···
1
-
{ stdenvNoCC
0
2
, mpv-unwrapped
3
-
, lib
4
}:
5
6
-
stdenvNoCC.mkDerivation rec {
0
7
pname = "mpv-acompressor";
8
-
version = mpv-unwrapped.version;
9
-
10
-
src = "${mpv-unwrapped.src.outPath}/TOOLS/lua/acompressor.lua";
11
-
12
-
dontBuild = true;
13
-
dontUnpack = true;
14
-
15
-
installPhase = ''
16
-
install -Dm644 ${src} $out/share/mpv/scripts/acompressor.lua
17
-
'';
18
-
19
-
passthru.scriptName = "acompressor.lua";
20
21
meta = with lib; {
0
22
description = "Script to toggle and control ffmpeg's dynamic range compression filter.";
23
homepage = "https://github.com/mpv-player/mpv/blob/master/TOOLS/lua/acompressor.lua";
24
-
license = licenses.gpl2Plus;
25
maintainers = with maintainers; [ nicoo ];
26
};
27
}
···
1
+
{ lib
2
+
, buildLua
3
, mpv-unwrapped
0
4
}:
5
6
+
buildLua {
7
+
inherit (mpv-unwrapped) src version;
8
pname = "mpv-acompressor";
9
+
scriptPath = "TOOLS/lua/acompressor.lua";
0
0
0
0
0
0
0
0
0
0
0
10
11
meta = with lib; {
12
+
inherit (mpv-unwrapped.meta) license;
13
description = "Script to toggle and control ffmpeg's dynamic range compression filter.";
14
homepage = "https://github.com/mpv-player/mpv/blob/master/TOOLS/lua/acompressor.lua";
0
15
maintainers = with maintainers; [ nicoo ];
16
};
17
}
+18
pkgs/applications/video/mpv/scripts/buildLua.nix
···
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
···
1
+
{ lib
2
+
, stdenvNoCC }:
3
+
4
+
let fileName = pathStr: lib.last (lib.splitString "/" pathStr);
5
+
in
6
+
lib.makeOverridable (
7
+
{ pname, scriptPath ? "${pname}.lua", ... }@args:
8
+
stdenvNoCC.mkDerivation (lib.attrsets.recursiveUpdate {
9
+
dontBuild = true;
10
+
preferLocalBuild = true;
11
+
12
+
outputHashMode = "recursive";
13
+
installPhase = "install -m644 -Dt $out/share/mpv/scripts ${scriptPath}";
14
+
passthru.scriptName = fileName scriptPath;
15
+
16
+
meta.platforms = lib.platforms.all;
17
+
} args)
18
+
)
+4
-15
pkgs/applications/video/mpv/scripts/chapterskip.nix
···
1
{ lib
2
, fetchFromGitHub
3
-
, nix-update-script
4
-
, stdenvNoCC }:
5
6
-
stdenvNoCC.mkDerivation {
7
pname = "chapterskip";
8
-
passthru.scriptName = "chapterskip.lua";
9
10
version = "unstable-2022-09-08";
11
src = fetchFromGitHub {
···
15
hash = "sha256-OTrLQE3rYvPQamEX23D6HttNjx3vafWdTMxTiWpDy90=";
16
};
17
18
-
dontBuild = true;
19
-
preferLocalBuild = true;
20
-
installPhase = "install -Dt $out/share/mpv/scripts chapterskip.lua";
21
-
22
-
passthru.updateScript = nix-update-script {
23
-
extraArgs = [ "--version=branch" ];
24
-
};
25
-
26
-
meta = with lib; {
27
homepage = "https://github.com/po5/chapterskip";
28
-
platforms = platforms.all;
29
-
maintainers = with maintainers; [ nicoo ];
30
};
31
}
···
1
{ lib
2
, fetchFromGitHub
3
+
, buildLua }:
0
4
5
+
buildLua {
6
pname = "chapterskip";
0
7
8
version = "unstable-2022-09-08";
9
src = fetchFromGitHub {
···
13
hash = "sha256-OTrLQE3rYvPQamEX23D6HttNjx3vafWdTMxTiWpDy90=";
14
};
15
16
+
meta = {
0
0
0
0
0
0
0
0
17
homepage = "https://github.com/po5/chapterskip";
18
+
maintainers = with lib.maintainers; [ nicoo ];
0
19
};
20
}
+5
-4
pkgs/applications/video/mpv/scripts/default.nix
···
3
, config
4
}:
5
6
-
lib.recurseIntoAttrs
0
7
({
8
-
acompressor = callPackage ./acompressor.nix { };
9
autocrop = callPackage ./autocrop.nix { };
10
autodeint = callPackage ./autodeint.nix { };
11
autoload = callPackage ./autoload.nix { };
12
-
chapterskip = callPackage ./chapterskip.nix { };
13
convert = callPackage ./convert.nix { };
14
inhibit-gnome = callPackage ./inhibit-gnome.nix { };
15
mpris = callPackage ./mpris.nix { };
···
27
webtorrent-mpv-hook = callPackage ./webtorrent-mpv-hook.nix { };
28
cutter = callPackage ./cutter.nix { };
29
}
30
-
// (callPackage ./occivink.nix { }))
31
// lib.optionalAttrs config.allowAliases {
32
youtube-quality = throw "'youtube-quality' is no longer maintained, use 'quality-menu' instead"; # added 2023-07-14
33
}
···
3
, config
4
}:
5
6
+
let buildLua = callPackage ./buildLua.nix { };
7
+
in lib.recurseIntoAttrs
8
({
9
+
acompressor = callPackage ./acompressor.nix { inherit buildLua; };
10
autocrop = callPackage ./autocrop.nix { };
11
autodeint = callPackage ./autodeint.nix { };
12
autoload = callPackage ./autoload.nix { };
13
+
chapterskip = callPackage ./chapterskip.nix { inherit buildLua; };
14
convert = callPackage ./convert.nix { };
15
inhibit-gnome = callPackage ./inhibit-gnome.nix { };
16
mpris = callPackage ./mpris.nix { };
···
28
webtorrent-mpv-hook = callPackage ./webtorrent-mpv-hook.nix { };
29
cutter = callPackage ./cutter.nix { };
30
}
31
+
// (callPackage ./occivink.nix { inherit buildLua; }))
32
// lib.optionalAttrs config.allowAliases {
33
youtube-quality = throw "'youtube-quality' is no longer maintained, use 'quality-menu' instead"; # added 2023-07-14
34
}
+7
-19
pkgs/applications/video/mpv/scripts/occivink.nix
···
1
{ lib
2
-
, stdenvNoCC
3
, fetchFromGitHub
0
4
}:
5
6
let
7
-
script = { n, ... }@p:
8
-
stdenvNoCC.mkDerivation (lib.attrsets.recursiveUpdate {
9
-
pname = "mpv_${n}";
10
-
passthru.scriptName = "${n}.lua";
11
-
12
src = fetchFromGitHub {
13
owner = "occivink";
14
repo = "mpv-scripts";
···
17
};
18
version = "unstable-2022-10-02";
19
20
-
dontBuild = true;
21
-
installPhase = ''
22
-
mkdir -p $out/share/mpv/scripts
23
-
cp -r scripts/${n}.lua $out/share/mpv/scripts/
24
-
'';
25
26
meta = with lib; {
27
homepage = "https://github.com/occivink/mpv-scripts";
28
license = licenses.unlicense;
29
-
platforms = platforms.all;
30
maintainers = with maintainers; [ nicoo ];
31
};
32
-
33
-
outputHashAlgo = "sha256";
34
-
outputHashMode = "recursive";
35
-
} p);
36
37
in
38
{
39
40
# Usage: `pkgs.mpv.override { scripts = [ pkgs.mpvScripts.seekTo ]; }`
41
seekTo = script {
42
-
n = "seek-to";
43
meta.description = "Mpv script for seeking to a specific position";
44
outputHash = "sha256-3RlbtUivmeoR9TZ6rABiZSd5jd2lFv/8p/4irHMLshs=";
45
};
46
47
blacklistExtensions = script {
48
-
n = "blacklist-extensions";
49
meta.description = "Automatically remove playlist entries based on their extension.";
50
outputHash = "sha256-qw9lz8ofmvvh23F9aWLxiU4YofY+YflRETu+nxMhvVE=";
51
};
52
-
53
}
···
1
{ lib
0
2
, fetchFromGitHub
3
+
, buildLua
4
}:
5
6
let
7
+
script = { pname, ...}@args:
8
+
buildLua (lib.attrsets.recursiveUpdate {
0
0
0
9
src = fetchFromGitHub {
10
owner = "occivink";
11
repo = "mpv-scripts";
···
14
};
15
version = "unstable-2022-10-02";
16
17
+
scriptPath = "scripts/${pname}.lua";
0
0
0
0
18
19
meta = with lib; {
20
homepage = "https://github.com/occivink/mpv-scripts";
21
license = licenses.unlicense;
0
22
maintainers = with maintainers; [ nicoo ];
23
};
24
+
} args);
0
0
0
25
26
in
27
{
28
29
# Usage: `pkgs.mpv.override { scripts = [ pkgs.mpvScripts.seekTo ]; }`
30
seekTo = script {
31
+
pname = "seek-to";
32
meta.description = "Mpv script for seeking to a specific position";
33
outputHash = "sha256-3RlbtUivmeoR9TZ6rABiZSd5jd2lFv/8p/4irHMLshs=";
34
};
35
36
blacklistExtensions = script {
37
+
pname = "blacklist-extensions";
38
meta.description = "Automatically remove playlist entries based on their extension.";
39
outputHash = "sha256-qw9lz8ofmvvh23F9aWLxiU4YofY+YflRETu+nxMhvVE=";
40
};
0
41
}