1{
2 lib,
3 buildLua,
4 fetchFromGitHub,
5 makeWrapper,
6 unstableGitUpdater,
7}:
8
9buildLua {
10 pname = "video-cutter";
11 version = "0-unstable-2023-11-10";
12
13 src = fetchFromGitHub {
14 owner = "rushmj";
15 repo = "mpv-video-cutter";
16 rev = "01a0396c075d5f8bbd1de5b571e6231f8899ab65";
17 sha256 = "sha256-veoRFzUCRH8TrvR7x+WWoycpDyxqrJZ/bnp61dVc0pE=";
18 };
19 passthru.updateScript = unstableGitUpdater { };
20
21 nativeBuildInputs = [ makeWrapper ];
22
23 postPatch = ''
24 substituteInPlace cutter.lua \
25 --replace-fail '~/.config/mpv/scripts/c_concat.sh' '${placeholder "out"}/share/mpv/scripts/c_concat.sh'
26
27 # needs to be ran separately so that we can replace everything, and not every single mention explicitly
28 # original script places them in the scripts folder, just spawning unnecessary errors
29 # i know that hardcoding .config and especially the .mpv directory isn't best practice, but I didn't want to deviate too much from upstream
30 substituteInPlace cutter.lua \
31 --replace-fail '~/.config/mpv/scripts' "''${XDG_CONFIG_HOME:-~/.config}/mpv/cutter"
32 '';
33
34 passthru.scriptName = "cutter.lua";
35 extraScripts = [ "c_concat.sh" ];
36
37 postInstall = ''
38 wrapProgram $out/share/mpv/scripts/c_concat.sh \
39 --run "mkdir -p ~/.config/mpv/cutter/"
40 '';
41
42 meta = with lib; {
43 description = "Cut videos and concat them automatically";
44 homepage = "https://github.com/rushmj/mpv-video-cutter";
45 license = licenses.mit;
46 maintainers = with maintainers; [ lom ];
47 };
48}