about summary refs log tree commit diff
path: root/pkgs/by-name/su/substudy/package.nix
blob: 55d368fb37494a2353ee4dd510cfa59a8d89fa7a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
{
  lib,
  fetchFromGitHub,
  rustPlatform,

  ffmpeg,
  makeWrapper,
}:

rustPlatform.buildRustPackage rec {
  pname = "substudy";
  version = "0.6.10";

  src = fetchFromGitHub {
    owner = "emk";
    repo = "subtitles-rs";
    rev = "${pname}_v${version}";
    hash = "sha256-ACYbSQKaOJ2hS8NbOAppfKo+Mk3CKg0OAwb56AH42Zs=";
  };

  cargoLock = {
    lockFile = ./Cargo.lock;
    outputHashes = {
      "async-openai-0.19.1" = "sha256-UrWSZW3LxMZfinmQAjouhqTrhVhHkjgz9EzrZxR0qG4=";
    };
  };

  nativeBuildInputs = [ makeWrapper ];

  nativeCheckInputs = [ ffmpeg ];

  cargoBuildFlags = [ "-p substudy" ];

  preCheck = ''
    # That's to make sure the `test_ai_request_static`
    # test has access to the cache at `$HOME/.cache`
    export HOME=$(mktemp -d)
  '';

  postFixup = ''
    wrapProgram "$out/bin/substudy" \
      --prefix PATH : ${lib.makeBinPath [ ffmpeg ]}
  '';

  meta = with lib; {
    description = "Learn foreign languages using audio and subtitles extracted from video files";
    homepage = "http://www.randomhacks.net/substudy";
    license = licenses.asl20;
    mainProgram = "substudy";
    maintainers = with maintainers; [ paveloom ];
  };
}