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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
{
buildGoModule,
fetchFromGitHub,
makeWrapper,
pkg-config,
libpulseaudio,
dotool,
libGL,
libxxf86vm,
libxrandr,
libxi,
libxinerama,
libxcursor,
libx11,
libxkbcommon,
wayland,
lib,
stdenv,
nix-update-script,
testers,
}:
buildGoModule (finalAttrs: {
pname = "voxinput";
version = "1.0.0";
src = fetchFromGitHub {
owner = "richiejp";
repo = "VoxInput";
tag = "v${finalAttrs.version}";
hash = "sha256-Zb3tz8YuS2VJWXbr8+yBuL89vlDXadFowSzWuZ5a0WI=";
};
vendorHash = "sha256-NMuHvhN1A6TQ18Z1H8k8Sy7Py9744Xv95MZz0QvExQY=";
nativeBuildInputs = [
makeWrapper
pkg-config
];
buildInputs = [
libpulseaudio
dotool
libGL
libx11.dev
libxcursor
libxi
libxinerama
libxrandr
libxxf86vm
libxkbcommon
wayland
];
# To take advantage of the udev rule something like `services.udev.packages = [ nixpkgs.voxinput ]`
# needs to be added to your configuration.nix
postInstall = ''
mv $out/bin/VoxInput $out/bin/voxinput_tmp ; mv $out/bin/voxinput_tmp $out/bin/voxinput
''
+ lib.optionalString stdenv.hostPlatform.isLinux ''
wrapProgram $out/bin/voxinput \
--prefix PATH : ${lib.makeBinPath [ dotool ]}
mkdir -p $out/lib/udev/rules.d
echo 'KERNEL=="uinput", GROUP="input", MODE="0620", OPTIONS+="static_node=uinput"' > $out/lib/udev/rules.d/99-voxinput.rules
'';
postFixup = lib.optionalString stdenv.hostPlatform.isElf ''
patchelf $out/bin/.voxinput-wrapped \
--add-rpath ${lib.makeLibraryPath [ libpulseaudio ]}
'';
passthru = {
updateScript = nix-update-script { };
tests.version = testers.testVersion {
package = finalAttrs.finalPackage;
command = "voxinput ver";
version = "v${finalAttrs.version}";
};
};
meta = {
homepage = "https://github.com/richiejp/VoxInput";
description = "Voice to text for any Linux app via dotool/uinput and the LocalAI/OpenAI transcription API";
license = lib.licenses.mit;
maintainers = [ lib.maintainers.richiejp ];
platforms = lib.platforms.unix;
changelog = "https://github.com/richiejp/VoxInput/releases/tag/v${finalAttrs.version}";
mainProgram = "voxinput";
};
})
|