summary refs log tree commit diff
path: root/pkgs/tools/audio/larynx/default.nix
blob: 2bc55a731a0f57b251eaecd70af5b5f32730a504 (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
{ lib
, stdenv
, fetchFromGitHub
, cmake
, pkg-config
, espeak-ng
, onnxruntime
, pcaudiolib
, larynx-train
}:

let
  pname = "larynx";
  version = "0.0.2";
in
stdenv.mkDerivation {
  inherit pname version;

  src = fetchFromGitHub {
    owner = "rhasspy";
    repo = "larynx2";
    rev = "refs/tags/v${version}";
    hash = "sha256-6SZ1T2A1DyVmBH2pJBHJdsnniRuLrI/dthRTRRyVSQQ=";
  };

  sourceRoot = "source/src/cpp";

  postPatch = ''
    substituteInPlace CMakeLists.txt \
      --replace "/usr/local/include/onnxruntime" "${onnxruntime}"
  '';

  nativeBuildInputs = [
    cmake
    pkg-config
  ];

  buildInputs = [
    espeak-ng
    onnxruntime
    pcaudiolib
  ];

  installPhase = ''
    runHook preInstall

    mkdir -p $out/bin
    install -m 0755 larynx $out/bin

    runHook postInstall
  '';

  passthru.tests = {
    inherit larynx-train;
  };

  meta = with lib; {
    changelog = "https://github.com/rhasspy/larynx2/releases/tag/v${version}";
    description = "A fast, local neural text to speech system";
    homepage = "https://github.com/rhasspy/larynx2";
    license = licenses.mit;
    maintainers = with maintainers; [ hexa ];
  };
}