20 src = fetchFromGitHub {
24 hash = "sha256-6z+A4bJIDfN/K8IjEdt2TqEa/EDt4uQpGh+zSWfP74I=";
28 (replaceVars ./hardcode-paths.patch {
29 sevenzip_path = lib.getExe _7zz;
30 voicevox_engine_path = lib.getExe voicevox-engine;
35 substituteInPlace package.json \
36 --replace-fail "999.999.999" "${version}" \
37 --replace-fail "postinstall" "_postinstall"
40 npmDepsHash = "sha256-NuKFhDb/J6G3pFYHZedKnY2hDC5GCp70DpqrST4bJMA=";
42 # unlock very specific node version bounds specified by upstream
43 npmInstallFlags = [ "--engine-strict=false" ];
49 ++ lib.optionals stdenv.hostPlatform.isLinux [
53 env.ELECTRON_SKIP_BINARY_DOWNLOAD = "1";
55 # disable code signing on Darwin
56 env.CSC_IDENTITY_AUTO_DISCOVERY = "false";
61 # force sass-embedded to use our own sass instead of the bundled one
62 substituteInPlace node_modules/sass-embedded/dist/lib/src/compiler-path.js \
63 --replace-fail 'compilerCommand = (() => {' 'compilerCommand = (() => { return ["${lib.getExe dart-sass}"];'
65 # build command taken from the definition of the `electron:build` npm script
66 VITE_TARGET=electron npm exec vite build
68 cp -r ${electron.dist} electron-dist
69 chmod -R u+w electron-dist
71 npm exec electron-builder -- \
73 --config electron-builder.config.js \
74 -c.electronDist=electron-dist \
75 -c.electronVersion=${electron.version}
83 ${lib.optionalString stdenv.hostPlatform.isLinux ''
84 install -Dm644 public/icon.png $out/share/icons/hicolor/256x256/apps/voicevox.png
86 mkdir -p $out/share/voicevox
87 cp -r dist_electron/*-unpacked/{locales,resources{,.pak}} $out/share/voicevox
89 makeWrapper ${lib.getExe electron} $out/bin/voicevox \
90 --add-flags $out/share/voicevox/resources/app.asar \
91 --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}}" \
95 ${lib.optionalString stdenv.hostPlatform.isDarwin ''
96 mkdir -p $out/Applications
97 cp -r dist_electron/mac*/VOICEVOX.app $out/Applications
98 makeWrapper $out/Applications/VOICEVOX.app/Contents/MacOS/VOICEVOX $out/bin/voicevox
109 desktopName = "VOICEVOX";
110 categories = [ "AudioVideo" ];
111 mimeTypes = [ "application/x-voicevox" ];
116 changelog = "https://github.com/VOICEVOX/voicevox/releases/tag/${src.tag}";
117 description = "Editor for the VOICEVOX speech synthesis software";
118 homepage = "https://github.com/VOICEVOX/voicevox";
119 license = lib.licenses.lgpl3Only;
120 mainProgram = "voicevox";
121 maintainers = with lib.maintainers; [
125 platforms = electron.meta.platforms;