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