lol

galene-stt: init at 0.1

authored by

OPNA2608 and committed by
Valentin Gagarin
d53d87f8 18900140

+91
+91
pkgs/by-name/ga/galene-stt/package.nix
··· 1 + { 2 + lib, 3 + buildGoModule, 4 + fetchFromGitHub, 5 + gitUpdater, 6 + writeShellApplication, 7 + _experimental-update-script-combinators, 8 + galene, 9 + libopus, 10 + nix, 11 + pkg-config, 12 + sd, 13 + whisper-cpp, 14 + }: 15 + 16 + buildGoModule (finalAttrs: { 17 + pname = "galene-stt"; 18 + version = "0.1"; 19 + 20 + src = fetchFromGitHub { 21 + owner = "jech"; 22 + repo = "galene-stt"; 23 + tag = "galene-stt-${finalAttrs.version}"; 24 + hash = "sha256-uW1b5T+p7KGvqt+PlR9d7bo62V+URHniS45sZP/VuLQ="; 25 + }; 26 + 27 + vendorHash = "sha256-UFOxo8jq+gxN1dkM2A/BQqtT9ggIp7qovFRLv3Q6Io0="; 28 + 29 + # Not necessary, but feels cleaner to pull it in like that 30 + postPatch = '' 31 + substituteInPlace whisper.go \ 32 + --replace-fail 'cgo LDFLAGS: -lwhisper' 'cgo pkg-config: whisper' 33 + ''; 34 + 35 + strictDeps = true; 36 + 37 + nativeBuildInputs = [ 38 + pkg-config 39 + ]; 40 + 41 + buildInputs = [ 42 + libopus 43 + whisper-cpp 44 + ]; 45 + 46 + ldflags = [ 47 + "-s" 48 + "-w" 49 + ]; 50 + 51 + passthru = { 52 + updateScriptSrc = gitUpdater { 53 + rev-prefix = "galene-stt-"; 54 + }; 55 + updateScriptVendor = writeShellApplication { 56 + name = "update-galene-stt-vendorHash"; 57 + runtimeInputs = [ 58 + nix 59 + sd 60 + ]; 61 + text = '' 62 + export UPDATE_NIX_ATTR_PATH="''${UPDATE_NIX_ATTR_PATH:-galene-stt}" 63 + 64 + oldhash="$(nix-instantiate . --eval --strict -A "$UPDATE_NIX_ATTR_PATH.goModules.drvAttrs.outputHash" | cut -d'"' -f2)" 65 + newhash="$(nix-build -A "$UPDATE_NIX_ATTR_PATH.goModules" --no-out-link 2>&1 | tail -n3 | grep 'got:' | cut -d: -f2- | xargs echo || true)" 66 + 67 + if [ "$newhash" == "" ]; then 68 + echo "No new vendorHash." 69 + exit 0 70 + fi 71 + 72 + fname="$(nix-instantiate --eval -E "with import ./. {}; (builtins.unsafeGetAttrPos \"version\" $UPDATE_NIX_ATTR_PATH).file" | cut -d'"' -f2)" 73 + 74 + ${sd.meta.mainProgram} --string-mode "$oldhash" "$newhash" "$fname" 75 + ''; 76 + }; 77 + updateScript = _experimental-update-script-combinators.sequence [ 78 + finalAttrs.passthru.updateScriptSrc.command 79 + (lib.getExe finalAttrs.passthru.updateScriptVendor) 80 + ]; 81 + }; 82 + 83 + meta = { 84 + description = "Speech-to-text support for Galene"; 85 + homepage = "https://github.com/jech/galene-stt"; 86 + changelog = "https://github.com/jech/galene-stt/raw/${finalAttrs.src.rev}/CHANGES"; 87 + license = lib.licenses.mit; 88 + platforms = lib.platforms.linux; 89 + inherit (galene.meta) maintainers; 90 + }; 91 + })