diff --git a/pkgs/by-name/vo/voicevox-core/package.nix b/pkgs/by-name/vo/voicevox-core/package.nix index 0283b9cbfb4c..556eb756424d 100644 --- a/pkgs/by-name/vo/voicevox-core/package.nix +++ b/pkgs/by-name/vo/voicevox-core/package.nix @@ -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 ]; @@ -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"; @@ -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 ]; }; })