1{
2 lib,
3 fetchFromGitHub,
4 rustPlatform,
5
6 ffmpeg,
7 makeWrapper,
8}:
9
10rustPlatform.buildRustPackage rec {
11 pname = "substudy";
12 version = "0.6.10";
13
14 src = fetchFromGitHub {
15 owner = "emk";
16 repo = "subtitles-rs";
17 rev = "substudy_v${version}";
18 hash = "sha256-ACYbSQKaOJ2hS8NbOAppfKo+Mk3CKg0OAwb56AH42Zs=";
19 };
20
21 cargoHash = "sha256-S+/Oh1Cwulw8FyakF+d2E51AioFuQBGMAOG3y27YM2Q=";
22
23 nativeBuildInputs = [ makeWrapper ];
24
25 nativeCheckInputs = [ ffmpeg ];
26
27 cargoBuildFlags = [ "-p substudy" ];
28
29 preCheck = ''
30 # That's to make sure the `test_ai_request_static`
31 # test has access to the cache at `$HOME/.cache`
32 export HOME=$(mktemp -d)
33 '';
34
35 postFixup = ''
36 wrapProgram "$out/bin/substudy" \
37 --prefix PATH : ${lib.makeBinPath [ ffmpeg ]}
38 '';
39
40 meta = with lib; {
41 description = "Learn foreign languages using audio and subtitles extracted from video files";
42 homepage = "https://www.randomhacks.net/substudy";
43 license = licenses.asl20;
44 mainProgram = "substudy";
45 maintainers = with maintainers; [ ];
46 };
47}