File tree Expand file tree Collapse file tree 1 file changed +30
-3
lines changed Expand file tree Collapse file tree 1 file changed +30
-3
lines changed Original file line number Diff line number Diff line change 101101
102102 packages = let
103103 cargoToml = builtins . fromTOML ( builtins . readFile ./Cargo.toml ) ;
104+
105+ # Override sentencepiece to use the same protobuf as onnxruntime
106+ # to avoid ABI conflicts
107+ sentencepieceFixed = pkgs . sentencepiece . overrideAttrs ( old : {
108+ buildInputs = ( old . buildInputs or [ ] ) ++ [ pkgs . protobuf ] ;
109+ cmakeFlags = ( old . cmakeFlags or [ ] ) ++ [
110+ "-DSPM_USE_BUILTIN_PROTOBUF=OFF"
111+ ] ;
112+ } ) ;
113+
104114 sonoriPkg = pkgs . rustPlatform . buildRustPackage rec {
105115 pname = "sonori" ;
106116 version = cargoToml . package . version ;
123133 vulkan-headers
124134 shaderc
125135 git
136+ makeWrapper # For wrapping binary with library paths
126137 ] ;
127138
128139 buildInputs = with pkgs ; [
142153 fftw
143154 curl
144155 ctranslate2
145- sentencepiece
146156 wtype
147157 vulkan-loader
148158 vulkan-headers
149159 openblas
150160 openblas . dev
151161 onnxruntime
152- ] ;
162+ protobuf # Ensure consistent protobuf version
163+ ] ++ [ sentencepieceFixed ] ; # Use our fixed sentencepiece
153164
154- # Environment variable to point ort-sys to system ONNX Runtime
165+ # Use system ONNX Runtime for Silero VAD
155166 ORT_STRATEGY = "system" ;
156167
157168 LIBCLANG_PATH = "${ pkgs . llvmPackages . libclang . lib } /lib" ;
162173 doCheck = false ;
163174
164175 postInstall = ''
176+ # Wrap binary with required library paths
177+ wrapProgram $out/bin/sonori \
178+ --prefix LD_LIBRARY_PATH : ${ pkgs . lib . makeLibraryPath [
179+ pkgs . libxkbcommon
180+ pkgs . wayland
181+ pkgs . xorg . libX11
182+ pkgs . xorg . libXcursor
183+ pkgs . xorg . libXi
184+ pkgs . xorg . libXrandr
185+ pkgs . vulkan-loader
186+ pkgs . openblas
187+ pkgs . onnxruntime
188+ pkgs . alsa-lib
189+ pkgs . portaudio
190+ ] }
191+
165192 # Install desktop file
166193 mkdir -p $out/share/applications
167194 install -m 644 ${ ./desktop/sonori.desktop } $out/share/applications/
You can’t perform that action at this time.
0 commit comments