Loading pkgs/by-name/vo/voicevox/hardcode-paths.patch +16 −27 Original line number Diff line number Diff line diff --git a/.env.production b/.env.production index 5b0dcb0..5848ccd 100644 index cc5e2b9..29140f8 100644 --- a/.env.production +++ b/.env.production @@ -4,7 +4,7 @@ VITE_DEFAULT_ENGINE_INFOS=`[ Loading @@ -12,10 +12,10 @@ index 5b0dcb0..5848ccd 100644 "host": "http://127.0.0.1:50021" } diff --git a/electron-builder.config.js b/electron-builder.config.js index 196a0d7..7e313c2 100644 index 10bd7dc..4597b23 100644 --- a/electron-builder.config.js +++ b/electron-builder.config.js @@ -37,18 +37,7 @@ const isArm64 = process.arch === "arm64"; @@ -38,18 +38,6 @@ const isArm64 = process.arch === "arm64"; // cf: https://k-hyoda.hatenablog.com/entry/2021/10/23/000349#%E8%BF%BD%E5%8A%A0%E5%B1%95%E9%96%8B%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB%E5%85%88%E3%81%AE%E8%A8%AD%E5%AE%9A const extraFilePrefix = isMac ? "MacOS/" : ""; Loading @@ -25,7 +25,7 @@ index 196a0d7..7e313c2 100644 - // Windows: 7za.exe, Linux: 7zzs, macOS: 7zz - (fileName) => ["7za.exe", "7zzs", "7zz"].includes(fileName), - ); - -if (!sevenZipFile) { - throw new Error( - "7z binary file not found. Run `node ./tools/download7z.js` first.", Loading @@ -34,7 +34,7 @@ index 196a0d7..7e313c2 100644 /** @type {import("electron-builder").Configuration} */ const builderOptions = { @@ -90,14 +79,6 @@ const builderOptions = { @@ -91,14 +79,6 @@ const builderOptions = { from: "build/README.txt", to: extraFilePrefix + "README.txt", }, Loading @@ -49,26 +49,15 @@ index 196a0d7..7e313c2 100644 ], // electron-builder installer productName: "VOICEVOX", diff --git a/src/backend/electron/manager/vvppManager.ts b/src/backend/electron/manager/vvppManager.ts index edd3177..22d0114 100644 --- a/src/backend/electron/manager/vvppManager.ts +++ b/src/backend/electron/manager/vvppManager.ts @@ -184,16 +184,8 @@ export class VvppManager { const args = ["x", "-o" + outputDir, archiveFile, "-t" + format]; diff --git a/src/backend/electron/vvppFile.ts b/src/backend/electron/vvppFile.ts index 7e152f1..1aaa8c4 100644 --- a/src/backend/electron/vvppFile.ts +++ b/src/backend/electron/vvppFile.ts @@ -220,6 +220,7 @@ export class VvppFileExtractor { } - let sevenZipPath = import.meta.env.VITE_7Z_BIN_NAME; - if (!sevenZipPath) { - throw new Error("7z path is not defined"); - } - if (import.meta.env.PROD) { - sevenZipPath = path.join( - path.dirname(app.getPath("exe")), - sevenZipPath, - ); - } + const sevenZipPath = `@sevenzip_path@`; + log.log( "Spawning 7z:", sevenZipPath, private getSevenZipPath(): string { + return "@sevenzip_path@"; let sevenZipPath = import.meta.env.VITE_7Z_BIN_NAME; if (!sevenZipPath) { throw new Error("7z path is not defined"); pkgs/by-name/vo/voicevox/package.nix +30 −21 Original line number Diff line number Diff line { lib, stdenv, buildNpmPackage, fetchFromGitHub, replaceVars, pnpm_9, nodejs, makeDesktopItem, copyDesktopItems, makeWrapper, Loading @@ -13,18 +14,19 @@ dart-sass, }: buildNpmPackage rec { stdenv.mkDerivation (finalAttrs: { pname = "voicevox"; version = "0.22.4"; version = "0.23.0"; src = fetchFromGitHub { owner = "VOICEVOX"; repo = "voicevox"; tag = version; hash = "sha256-IOs3wBcFYpO4AHiWFOQWd5hp6EmwyA7Rcc8wjHKvYNQ="; tag = finalAttrs.version; hash = "sha256-wCC4wl5LPJVJQtV+X795rIXnURseQYiCZ9B6YujTFFw="; }; patches = [ ./unlock-node-and-pnpm-versions.patch (replaceVars ./hardcode-paths.patch { sevenzip_path = lib.getExe _7zz; voicevox_engine_path = lib.getExe voicevox-engine; Loading @@ -33,18 +35,25 @@ buildNpmPackage rec { postPatch = '' substituteInPlace package.json \ --replace-fail "999.999.999" "${version}" \ --replace-fail "postinstall" "_postinstall" --replace-fail "999.999.999" "$version" \ --replace-fail ' && electron-builder --config electron-builder.config.js --publish never' "" ''; npmDepsHash = "sha256-NuKFhDb/J6G3pFYHZedKnY2hDC5GCp70DpqrST4bJMA="; # unlock very specific node version bounds specified by upstream npmInstallFlags = [ "--engine-strict=false" ]; pnpmDeps = pnpm_9.fetchDeps { inherit (finalAttrs) pname version src patches ; hash = "sha256-IuyDHAomaGEvGbN4gLpyPfZGm/pF9XK+BkXSipaM7NQ="; }; nativeBuildInputs = [ makeWrapper pnpm_9.configHook nodejs ] ++ lib.optionals stdenv.hostPlatform.isLinux [ copyDesktopItems Loading @@ -62,13 +71,13 @@ buildNpmPackage rec { substituteInPlace node_modules/sass-embedded/dist/lib/src/compiler-path.js \ --replace-fail 'compilerCommand = (() => {' 'compilerCommand = (() => { return ["${lib.getExe dart-sass}"];' # build command taken from the definition of the `electron:build` npm script VITE_TARGET=electron npm exec vite build cp -r ${electron.dist} electron-dist chmod -R u+w electron-dist npm exec electron-builder -- \ # note: we patched out the call to electron-builder in postPatch pnpm run electron:build pnpm exec electron-builder \ --dir \ --config electron-builder.config.js \ -c.electronDist=electron-dist \ Loading Loading @@ -113,7 +122,7 @@ buildNpmPackage rec { ]; meta = { changelog = "https://github.com/VOICEVOX/voicevox/releases/tag/${src.tag}"; changelog = "https://github.com/VOICEVOX/voicevox/releases/tag/${finalAttrs.src.tag}"; description = "Editor for the VOICEVOX speech synthesis software"; homepage = "https://github.com/VOICEVOX/voicevox"; license = lib.licenses.lgpl3Only; Loading @@ -124,4 +133,4 @@ buildNpmPackage rec { ]; platforms = electron.meta.platforms; }; } }) pkgs/by-name/vo/voicevox/unlock-node-and-pnpm-versions.patch 0 → 100644 +18 −0 Original line number Diff line number Diff line diff --git a/package.json b/package.json index d0a58b4..b57b91c 100644 --- a/package.json +++ b/package.json @@ -4,13 +4,6 @@ "author": "Hiroshiba Kazuyuki", "private": true, "main": "./dist/main.js", - "engines": { - "node": ">=22.14.0 <23" - }, - "volta": { - "node": "22.14.0" - }, - "packageManager": "pnpm@10.3.0", "scripts": { "// --- lint ---": "", "lint": "eslint .", Loading
pkgs/by-name/vo/voicevox/hardcode-paths.patch +16 −27 Original line number Diff line number Diff line diff --git a/.env.production b/.env.production index 5b0dcb0..5848ccd 100644 index cc5e2b9..29140f8 100644 --- a/.env.production +++ b/.env.production @@ -4,7 +4,7 @@ VITE_DEFAULT_ENGINE_INFOS=`[ Loading @@ -12,10 +12,10 @@ index 5b0dcb0..5848ccd 100644 "host": "http://127.0.0.1:50021" } diff --git a/electron-builder.config.js b/electron-builder.config.js index 196a0d7..7e313c2 100644 index 10bd7dc..4597b23 100644 --- a/electron-builder.config.js +++ b/electron-builder.config.js @@ -37,18 +37,7 @@ const isArm64 = process.arch === "arm64"; @@ -38,18 +38,6 @@ const isArm64 = process.arch === "arm64"; // cf: https://k-hyoda.hatenablog.com/entry/2021/10/23/000349#%E8%BF%BD%E5%8A%A0%E5%B1%95%E9%96%8B%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB%E5%85%88%E3%81%AE%E8%A8%AD%E5%AE%9A const extraFilePrefix = isMac ? "MacOS/" : ""; Loading @@ -25,7 +25,7 @@ index 196a0d7..7e313c2 100644 - // Windows: 7za.exe, Linux: 7zzs, macOS: 7zz - (fileName) => ["7za.exe", "7zzs", "7zz"].includes(fileName), - ); - -if (!sevenZipFile) { - throw new Error( - "7z binary file not found. Run `node ./tools/download7z.js` first.", Loading @@ -34,7 +34,7 @@ index 196a0d7..7e313c2 100644 /** @type {import("electron-builder").Configuration} */ const builderOptions = { @@ -90,14 +79,6 @@ const builderOptions = { @@ -91,14 +79,6 @@ const builderOptions = { from: "build/README.txt", to: extraFilePrefix + "README.txt", }, Loading @@ -49,26 +49,15 @@ index 196a0d7..7e313c2 100644 ], // electron-builder installer productName: "VOICEVOX", diff --git a/src/backend/electron/manager/vvppManager.ts b/src/backend/electron/manager/vvppManager.ts index edd3177..22d0114 100644 --- a/src/backend/electron/manager/vvppManager.ts +++ b/src/backend/electron/manager/vvppManager.ts @@ -184,16 +184,8 @@ export class VvppManager { const args = ["x", "-o" + outputDir, archiveFile, "-t" + format]; diff --git a/src/backend/electron/vvppFile.ts b/src/backend/electron/vvppFile.ts index 7e152f1..1aaa8c4 100644 --- a/src/backend/electron/vvppFile.ts +++ b/src/backend/electron/vvppFile.ts @@ -220,6 +220,7 @@ export class VvppFileExtractor { } - let sevenZipPath = import.meta.env.VITE_7Z_BIN_NAME; - if (!sevenZipPath) { - throw new Error("7z path is not defined"); - } - if (import.meta.env.PROD) { - sevenZipPath = path.join( - path.dirname(app.getPath("exe")), - sevenZipPath, - ); - } + const sevenZipPath = `@sevenzip_path@`; + log.log( "Spawning 7z:", sevenZipPath, private getSevenZipPath(): string { + return "@sevenzip_path@"; let sevenZipPath = import.meta.env.VITE_7Z_BIN_NAME; if (!sevenZipPath) { throw new Error("7z path is not defined");
pkgs/by-name/vo/voicevox/package.nix +30 −21 Original line number Diff line number Diff line { lib, stdenv, buildNpmPackage, fetchFromGitHub, replaceVars, pnpm_9, nodejs, makeDesktopItem, copyDesktopItems, makeWrapper, Loading @@ -13,18 +14,19 @@ dart-sass, }: buildNpmPackage rec { stdenv.mkDerivation (finalAttrs: { pname = "voicevox"; version = "0.22.4"; version = "0.23.0"; src = fetchFromGitHub { owner = "VOICEVOX"; repo = "voicevox"; tag = version; hash = "sha256-IOs3wBcFYpO4AHiWFOQWd5hp6EmwyA7Rcc8wjHKvYNQ="; tag = finalAttrs.version; hash = "sha256-wCC4wl5LPJVJQtV+X795rIXnURseQYiCZ9B6YujTFFw="; }; patches = [ ./unlock-node-and-pnpm-versions.patch (replaceVars ./hardcode-paths.patch { sevenzip_path = lib.getExe _7zz; voicevox_engine_path = lib.getExe voicevox-engine; Loading @@ -33,18 +35,25 @@ buildNpmPackage rec { postPatch = '' substituteInPlace package.json \ --replace-fail "999.999.999" "${version}" \ --replace-fail "postinstall" "_postinstall" --replace-fail "999.999.999" "$version" \ --replace-fail ' && electron-builder --config electron-builder.config.js --publish never' "" ''; npmDepsHash = "sha256-NuKFhDb/J6G3pFYHZedKnY2hDC5GCp70DpqrST4bJMA="; # unlock very specific node version bounds specified by upstream npmInstallFlags = [ "--engine-strict=false" ]; pnpmDeps = pnpm_9.fetchDeps { inherit (finalAttrs) pname version src patches ; hash = "sha256-IuyDHAomaGEvGbN4gLpyPfZGm/pF9XK+BkXSipaM7NQ="; }; nativeBuildInputs = [ makeWrapper pnpm_9.configHook nodejs ] ++ lib.optionals stdenv.hostPlatform.isLinux [ copyDesktopItems Loading @@ -62,13 +71,13 @@ buildNpmPackage rec { substituteInPlace node_modules/sass-embedded/dist/lib/src/compiler-path.js \ --replace-fail 'compilerCommand = (() => {' 'compilerCommand = (() => { return ["${lib.getExe dart-sass}"];' # build command taken from the definition of the `electron:build` npm script VITE_TARGET=electron npm exec vite build cp -r ${electron.dist} electron-dist chmod -R u+w electron-dist npm exec electron-builder -- \ # note: we patched out the call to electron-builder in postPatch pnpm run electron:build pnpm exec electron-builder \ --dir \ --config electron-builder.config.js \ -c.electronDist=electron-dist \ Loading Loading @@ -113,7 +122,7 @@ buildNpmPackage rec { ]; meta = { changelog = "https://github.com/VOICEVOX/voicevox/releases/tag/${src.tag}"; changelog = "https://github.com/VOICEVOX/voicevox/releases/tag/${finalAttrs.src.tag}"; description = "Editor for the VOICEVOX speech synthesis software"; homepage = "https://github.com/VOICEVOX/voicevox"; license = lib.licenses.lgpl3Only; Loading @@ -124,4 +133,4 @@ buildNpmPackage rec { ]; platforms = electron.meta.platforms; }; } })
pkgs/by-name/vo/voicevox/unlock-node-and-pnpm-versions.patch 0 → 100644 +18 −0 Original line number Diff line number Diff line diff --git a/package.json b/package.json index d0a58b4..b57b91c 100644 --- a/package.json +++ b/package.json @@ -4,13 +4,6 @@ "author": "Hiroshiba Kazuyuki", "private": true, "main": "./dist/main.js", - "engines": { - "node": ">=22.14.0 <23" - }, - "volta": { - "node": "22.14.0" - }, - "packageManager": "pnpm@10.3.0", "scripts": { "// --- lint ---": "", "lint": "eslint .",