|
| 1 | +{ |
| 2 | + lib, |
| 3 | + rustPlatform, |
| 4 | + fetchFromGitHub, |
| 5 | + nix-update-script, |
| 6 | + |
| 7 | + git, |
| 8 | + cmake, |
| 9 | + clang, |
| 10 | + pkg-config, |
| 11 | + makeWrapper, |
| 12 | + libclang, |
| 13 | + |
| 14 | + alsa-lib, |
| 15 | + openssl, |
| 16 | + wtype, |
| 17 | + wl-clipboard, |
| 18 | + libnotify, |
| 19 | + pciutils, |
| 20 | + |
| 21 | + shaderc, |
| 22 | + vulkan-headers, |
| 23 | + vulkan-loader, |
| 24 | + |
| 25 | + # one of `[ null "vulkan" ]` |
| 26 | + acceleration ? null, |
| 27 | +}: |
| 28 | + |
| 29 | +assert builtins.elem acceleration [ |
| 30 | + null |
| 31 | + "vulkan" |
| 32 | +]; |
| 33 | + |
| 34 | +let |
| 35 | + vulkanEnabled = acceleration == "vulkan"; |
| 36 | +in |
| 37 | +rustPlatform.buildRustPackage (finalAttrs: { |
| 38 | + pname = "voxtype"; |
| 39 | + version = "0.5.6"; |
| 40 | + |
| 41 | + src = fetchFromGitHub { |
| 42 | + owner = "peteonrails"; |
| 43 | + repo = "voxtype"; |
| 44 | + tag = "v${finalAttrs.version}"; |
| 45 | + hash = "sha256-taPmGWRQGIXxWCl4+1KL609LDBDj6HpxIxFrRr5M86E="; |
| 46 | + }; |
| 47 | + |
| 48 | + buildFeatures = lib.optionals vulkanEnabled [ "gpu-vulkan" ]; |
| 49 | + |
| 50 | + cargoHash = "sha256-p6VLVya8yw+a/ZVM4WP4Th8cScVDX1o89A9v+0+5vIQ="; |
| 51 | + |
| 52 | + nativeBuildInputs = [ |
| 53 | + git # Required by whisper.cpp cmake |
| 54 | + cmake |
| 55 | + clang |
| 56 | + pkg-config |
| 57 | + makeWrapper |
| 58 | + ] |
| 59 | + ++ lib.optionals vulkanEnabled [ |
| 60 | + shaderc |
| 61 | + ]; |
| 62 | + |
| 63 | + buildInputs = [ |
| 64 | + alsa-lib |
| 65 | + openssl |
| 66 | + ] |
| 67 | + ++ lib.optionals vulkanEnabled [ |
| 68 | + vulkan-headers |
| 69 | + vulkan-loader |
| 70 | + ]; |
| 71 | + |
| 72 | + LIBCLANG_PATH = "${libclang.lib}/lib"; |
| 73 | + |
| 74 | + postInstall = '' |
| 75 | + wrapProgram $out/bin/voxtype \ |
| 76 | + --prefix PATH : ${ |
| 77 | + lib.makeBinPath [ |
| 78 | + wtype # Wayland typing |
| 79 | + wl-clipboard # Wayland clipboard (wl-copy, wl-paste) |
| 80 | + libnotify # Desktop notifications |
| 81 | + pciutils # GPU detection (lspci) |
| 82 | + ] |
| 83 | + } |
| 84 | + ''; |
| 85 | + |
| 86 | + passthru.update-script = nix-update-script { }; |
| 87 | + |
| 88 | + meta = { |
| 89 | + description = |
| 90 | + "Voice-to-text with push-to-talk for Wayland compositors" |
| 91 | + + lib.optionalString vulkanEnabled ", using Vulkan for generic GPU acceleration"; |
| 92 | + homepage = "https://voxtype.io"; |
| 93 | + downloadPage = "https://voxtype.io/download/"; |
| 94 | + changelog = "https://github.com/peteonrails/voxtype/releases/tag/v${finalAttrs.version}"; |
| 95 | + license = lib.licenses.mit; |
| 96 | + maintainers = with lib.maintainers; [ DuskyElf ]; |
| 97 | + platforms = lib.platforms.linux; |
| 98 | + mainProgram = "voxtype"; |
| 99 | + }; |
| 100 | +}) |
0 commit comments