summary refs log tree commit diff
path: root/pkgs/applications/misc/livecaptions/default.nix
blob: 2d52e96fe3597b2c4d3ae35b15d3c7348ce6d6f0 (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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
{
  lib,
  stdenv,
  fetchFromGitHub,
  fetchurl,
  meson,
  ninja,
  pkg-config,
  cmake,
  desktop-file-utils,
  wrapGAppsHook4,
  onnxruntime,
  libadwaita,
  libpulseaudio,
  xorg,
}: let
  aprilAsr = fetchFromGitHub {
    name = "april-asr";
    owner = "abb128";
    repo = "april-asr";
    rev = "3308e68442664552de593957cad0fa443ea183dd";
    hash = "sha256-/cOZ2EcZu/Br9v0ComxnOegcEtlC9e8FYt3XHfah7mE=";
  };

  aprilModel = fetchurl {
    name = "april-english-dev-01110_en.april";
    url = "https://april.sapples.net/april-english-dev-01110_en.april";
    hash = "sha256-d+uV0PpPdwijfoaMImUwHubELcsl5jymPuo9nLrbwfM=";
  };
in
  stdenv.mkDerivation (finalAttrs: {
    pname = "livecaptions";
    version = "0.4.1";

    src = fetchFromGitHub {
      owner = "abb128";
      repo = "LiveCaptions";
      rev = "v${finalAttrs.version}";
      hash = "sha256-x8NetSooIBlOKzKUMvDkPFtpD6EVGYECnaqWurySUDU=";
    };

    nativeBuildInputs = [
      meson
      ninja
      pkg-config
      cmake
      desktop-file-utils # update-desktop-database
      wrapGAppsHook4
    ];

    buildInputs = [
      onnxruntime
      libadwaita
      libpulseaudio
      xorg.libX11
    ];

    postUnpack = ''
      rm -r source/subprojects/april-asr
      ln -sf ${aprilAsr} source/subprojects/april-asr
    '';

    preFixup = ''
      gappsWrapperArgs+=(
        --set APRIL_MODEL_PATH ${aprilModel}
      )
    '';

    meta = with lib; {
      description = "Linux Desktop application that provides live captioning";
      homepage = "https://github.com/abb128/LiveCaptions";
      license = licenses.gpl3Plus;
      platforms = platforms.linux;
      maintainers = with maintainers; [Scrumplex];
      mainProgram = "livecaptions";
    };
  })