1{
2 lib,
3 fetchFromGitHub,
4 buildLua,
5 ffsubsync,
6}:
7
8buildLua {
9 pname = "autosubsync-mpv";
10 version = "0-unstable-2024-10-29";
11
12 src = fetchFromGitHub {
13 owner = "joaquintorres";
14 repo = "autosubsync-mpv";
15 rev = "125ac13d1b84b3a64bb2e912225a8356c1c01364";
16 sha256 = "sha256-Xwu8WTB3p3YDTydfyidF/zpN6CyTQyZgQvGX/HAa9hw=";
17 };
18
19 # While nixpkgs only packages alass, we might as well make that the default
20 patchPhase = ''
21 runHook prePatch
22 substituteInPlace autosubsync.lua \
23 --replace-warn 'ffsubsync_path = ""' 'ffsubsync_path = "${lib.getExe ffsubsync}"' \
24 --replace-warn 'audio_subsync_tool = "ask"' 'audio_subsync_tool = "ffsubsync"' \
25 --replace-warn 'altsub_subsync_tool = "ask"' 'altsub_subsync_tool = "ffsubsync"'
26 runHook postPatch
27 '';
28
29 scriptPath = "./";
30 passthru.scriptName = "autosubsync-mpv";
31
32 meta = with lib; {
33 description = "Automatically sync subtitles in mpv using the `n` button";
34 homepage = "https://github.com/joaquintorres/autosubsync-mpv";
35 maintainers = with maintainers; [ kovirobi ];
36 license = licenses.mit;
37 };
38}