Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

voicevox: 0.20.0 -> 0.22.3; voicevox-engine: 0.20.0 -> 0.22.2; voicevox-core: 0.15.4 -> 0.15.7 #367083

Merged
merged 3 commits into from
Jan 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 41 additions & 34 deletions pkgs/by-name/vo/voicevox-core/package.nix
Original file line number Diff line number Diff line change
@@ -1,45 +1,18 @@
{
lib,
stdenv,
fetchzip,
fetchurl,
unzip,
autoPatchelfHook,
}:

let
platformInfoTable = {
"x86_64-linux" = {
id = "linux-x64";
hash = "sha256-/PD5e0bWgnIsIrvyOypoJw30VkgbOFWV1NJpPS2G0WM=";
};
"aarch64-linux" = {
id = "linux-arm64";
hash = "sha256-zfiorXZyIISZPXPwmcdYeHceDmQXkUhsvTkNZScg648=";
};
"x86_64-darwin" = {
id = "osx-x64";
hash = "sha256-cdNdV1fVPkz6B7vtKZiPsLQGqnIiDtYa9KTcwSkjdJg=";
};
"aarch64-darwin" = {
id = "osx-arm64";
hash = "sha256-Z1dq2t/HBQulbPF23ZCihOrcZHMpTXEQ6yXKORZaFPk=";
};
};

platformInfo =
platformInfoTable.${stdenv.hostPlatform.system}
or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
in
stdenv.mkDerivation (finalAttrs: {
pname = "voicevox-core";
version = "0.15.4";
version = "0.15.7";

# Note: Only the prebuilt binaries are able to decrypt the encrypted voice models
src = fetchzip {
url = "https://github.com/VOICEVOX/voicevox_core/releases/download/${finalAttrs.version}/voicevox_core-${platformInfo.id}-cpu-${finalAttrs.version}.zip";
inherit (platformInfo) hash;
};
src = finalAttrs.passthru.sources.${stdenv.hostPlatform.system};

nativeBuildInputs = lib.optionals stdenv.hostPlatform.isLinux [ autoPatchelfHook ];
nativeBuildInputs = [ unzip ] ++ lib.optionals stdenv.hostPlatform.isLinux [ autoPatchelfHook ];

buildInputs = [ stdenv.cc.cc.lib ];

Expand All @@ -54,6 +27,37 @@ stdenv.mkDerivation (finalAttrs: {
runHook postInstall
'';

# When updating, run the following command to fetch all FODs:
# nix-build -A voicevox-core.sources --keep-going
passthru.sources =
let
# Note: Only the prebuilt binaries are able to decrypt the encrypted voice models
fetchCoreArtifact =
{ id, hash }:
fetchurl {
url = "https://github.com/VOICEVOX/voicevox_core/releases/download/${finalAttrs.version}/voicevox_core-${id}-cpu-${finalAttrs.version}.zip";
inherit hash;
};
in
{
"x86_64-linux" = fetchCoreArtifact {
id = "linux-x64";
hash = "sha256-7FgrJ1HlB8l5MHd2KM4lYRx2bYdxrD2+su1G33/ugUA=";
};
"aarch64-linux" = fetchCoreArtifact {
id = "linux-arm64";
hash = "sha256-fD7YMTo9jeB4vJibnVwX8VrukCUeAwS6VXGOr3VXG+c=";
};
"x86_64-darwin" = fetchCoreArtifact {
id = "osx-x64";
hash = "sha256-5h9qEKbdcvip50TLs3vf6lXkSv24VEjOrx6CTUo7Q4Q=";
};
"aarch64-darwin" = fetchCoreArtifact {
id = "osx-arm64";
hash = "sha256-0bFLhvP7LqDzuk3pyM9QZfc8eLMW0IgqVkaXsuS3qlY=";
};
};

meta = {
changelog = "https://github.com/VOICEVOX/voicevox_core/releases/tag/${finalAttrs.version}";
description = "Core library for the VOICEVOX speech synthesis software";
Expand All @@ -67,8 +71,11 @@ stdenv.mkDerivation (finalAttrs: {
redistributable = true;
})
];
maintainers = with lib.maintainers; [ tomasajt ];
platforms = lib.attrNames platformInfoTable;
maintainers = with lib.maintainers; [
tomasajt
eljamm
];
platforms = lib.attrNames finalAttrs.passthru.sources;
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
};
})
22 changes: 15 additions & 7 deletions pkgs/by-name/vo/voicevox-engine/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@

python3Packages.buildPythonApplication rec {
pname = "voicevox-engine";
version = "0.20.0";
version = "0.22.2";
pyproject = true;

src = fetchFromGitHub {
owner = "VOICEVOX";
repo = "voicevox_engine";
rev = "refs/tags/${version}";
hash = "sha256-Gib5R7oleg+XXyu2V65EqrflQ1oiAR7a09a0MFhSITc=";
tag = version;
hash = "sha256-TZycd3xX5d4dNk4ze2JozyO7zDpGAuO+O7xHAx7QXUI=";
};

patches = [
Expand Down Expand Up @@ -95,6 +95,10 @@ python3Packages.buildPythonApplication rec {
# this test checks the behaviour of openapi
# one of the functions returns a slightly different output due to openapi version differences
"test_OpenAPIの形が変わっていないことを確認"

# these tests fail due to some tiny floating point discrepancies
"test_upspeak_voiced_last_mora"
"test_upspeak_voiced_N_last_mora"
];

nativeCheckInputs = with python3Packages; [
Expand All @@ -105,22 +109,26 @@ python3Packages.buildPythonApplication rec {

passthru = {
resources = fetchFromGitHub {
name = "voicevox-resource-${version}"; # this contains ${version} to invalidate the hash upon updating the package
owner = "VOICEVOX";
repo = "voicevox_resource";
rev = "refs/tags/${version}";
hash = "sha256-m888DF9qgGbK30RSwNnAoT9D0tRJk6cD5QY72FRkatM=";
tag = version;
hash = "sha256-oeWJESm1v0wicAXXFAyZT8z4QRVv9c+3vsWksmuY5wY=";
};

pyopenjtalk = python3Packages.callPackage ./pyopenjtalk.nix { };
};

meta = {
changelog = "https://github.com/VOICEVOX/voicevox_engine/releases/tag/${version}";
changelog = "https://github.com/VOICEVOX/voicevox_engine/releases/tag/${src.tag}";
description = "Engine for the VOICEVOX speech synthesis software";
homepage = "https://github.com/VOICEVOX/voicevox_engine";
license = lib.licenses.lgpl3Only;
mainProgram = "voicevox-engine";
maintainers = with lib.maintainers; [ tomasajt ];
maintainers = with lib.maintainers; [
tomasajt
eljamm
];
platforms = lib.platforms.linux ++ lib.platforms.darwin;
};
}
21 changes: 10 additions & 11 deletions pkgs/by-name/vo/voicevox/hardcode-paths.patch
Original file line number Diff line number Diff line change
Expand Up @@ -12,30 +12,29 @@ index 5b0dcb0..5848ccd 100644
"host": "http://127.0.0.1:50021"
}
diff --git a/electron-builder.config.js b/electron-builder.config.js
index 462e6f2..10a9bff 100644
index 196a0d7..7e313c2 100644
--- a/electron-builder.config.js
+++ b/electron-builder.config.js
@@ -35,19 +35,6 @@ const isMac = process.platform === "darwin";
@@ -37,18 +37,7 @@ 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/" : "";

-const sevenZipFile = fs
- .readdirSync(path.resolve(__dirname, "build", "vendored", "7z"))
- .readdirSync(path.resolve(__dirname, "vendored", "7z"))
- .find(
- // 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 ./build/download7z.js` first.",
- "7z binary file not found. Run `node ./tools/download7z.js` first.",
- );
-}
-
/** @type {import("electron-builder").Configuration} */
const builderOptions = {
beforeBuild: async () => {
@@ -88,14 +75,6 @@ const builderOptions = {
@@ -90,14 +79,6 @@ const builderOptions = {
from: "build/README.txt",
to: extraFilePrefix + "README.txt",
},
Expand All @@ -44,17 +43,17 @@ index 462e6f2..10a9bff 100644
- to: path.join(extraFilePrefix, "vv-engine"),
- },
- {
- from: path.resolve(__dirname, "build", "vendored", "7z", sevenZipFile),
- from: path.resolve(__dirname, "vendored", "7z", sevenZipFile),
- to: extraFilePrefix + sevenZipFile,
- },
],
// electron-builder installer
productName: "VOICEVOX",
diff --git a/src/backend/electron/manager/vvppManager.ts b/src/backend/electron/manager/vvppManager.ts
index 6aa17b6..b8b52b7 100644
index edd3177..22d0114 100644
--- a/src/backend/electron/manager/vvppManager.ts
+++ b/src/backend/electron/manager/vvppManager.ts
@@ -196,16 +196,8 @@ export class VvppManager {
@@ -184,16 +184,8 @@ export class VvppManager {

const args = ["x", "-o" + outputDir, archiveFile, "-t" + format];

Expand Down
23 changes: 17 additions & 6 deletions pkgs/by-name/vo/voicevox/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,18 @@
electron,
_7zz,
voicevox-engine,
dart-sass,
}:

buildNpmPackage rec {
pname = "voicevox";
version = "0.20.0";
version = "0.22.3";

src = fetchFromGitHub {
owner = "VOICEVOX";
repo = "voicevox";
rev = "refs/tags/${version}";
hash = "sha256-05WTecNc1xxe7SGDPZbLtRELNghFkMTqI4pkX4PsVWI=";
tag = version;
hash = "sha256-6z+A4bJIDfN/K8IjEdt2TqEa/EDt4uQpGh+zSWfP74I=";
};

patches = [
Expand All @@ -36,7 +37,10 @@ buildNpmPackage rec {
--replace-fail "postinstall" "_postinstall"
'';

npmDepsHash = "sha256-g3avCj3S96qYPAyGXn4yvrZ4gteJld+g4eV4aRtv/3g=";
npmDepsHash = "sha256-NuKFhDb/J6G3pFYHZedKnY2hDC5GCp70DpqrST4bJMA=";

# unlock very specific node version bounds specified by upstream
npmInstallFlags = [ "--engine-strict=false" ];

nativeBuildInputs =
[
Expand All @@ -54,6 +58,10 @@ buildNpmPackage rec {
buildPhase = ''
runHook preBuild

# force sass-embedded to use our own sass instead of the bundled one
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

Expand Down Expand Up @@ -105,12 +113,15 @@ buildNpmPackage rec {
];

meta = {
changelog = "https://github.com/VOICEVOX/voicevox/releases/tag/${version}";
changelog = "https://github.com/VOICEVOX/voicevox/releases/tag/${src.tag}";
description = "Editor for the VOICEVOX speech synthesis software";
homepage = "https://github.com/VOICEVOX/voicevox";
license = lib.licenses.lgpl3Only;
mainProgram = "voicevox";
maintainers = with lib.maintainers; [ tomasajt ];
maintainers = with lib.maintainers; [
tomasajt
eljamm
];
platforms = electron.meta.platforms;
};
}
Loading