nixconfig/packages/vosk/cli/default.nix

29 lines
903 B
Nix
Raw Normal View History

2023-11-04 02:28:27 +01:00
{ lib, stdenv, fetchFromGitea, buildGoModule, makeWrapper, pkgs, alsa-utils }:
buildGoModule rec {
pname = "voskcli";
version = "5eedba33b96dcd3826010cbd12e404cbfb544383";
2023-11-16 23:06:28 +01:00
vendorHash = "sha256-8l2i/fhN+2q+tjHpWdjRmesDDBBpxEPrTB8IE5Cr0I8=";
2023-11-04 02:28:27 +01:00
src = fetchFromGitea {
domain = "git.helcel.net";
owner = "helcel";
repo = pname;
rev = version;
sha256 = "sha256-TeCUtHuBGVyV+YmY3MGaf1jydTWgZITUgmUZzy4wZLU=";
};
preBuild = ''
export CGO_CFLAGS="-I${pkgs.vosk}/include"
export CGO_LDFLAGS="-L${pkgs.vosk}/lib"
'';
nativeBuildInputs = [ makeWrapper ];
installPhase = ''
runHook preInstall
install -Dm755 $GOPATH/bin/voskcli -t $out/bin
runHook postInstall
'';
postFixup = ''
wrapProgram $out/bin/voskcli \
--prefix PATH : ${lib.makeBinPath [ alsa-utils ]} \
--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ stdenv.cc.cc.lib ]} \
'';
}