nixpkgs/pkgs/applications/audio/mbrola/default.nix
Vladimír Čunát 56cefcddc6
mbrola: convert data to a fixed-output derivation
It's quite annoying that we had to redownload this 0.65G
on every rebuild.  Also disk space gets saved, unless you
used some deduplication (e.g. nix.settings.auto-optimise-store).
And cache.nixos.org space, too.
2023-10-17 13:21:04 +02:00

67 lines
1.7 KiB
Nix

{ stdenv, lib, fetchFromGitHub, runCommandLocal }:
let
pname = "mbrola";
version = "3.3";
meta = with lib; {
license = licenses.agpl3Plus;
maintainers = with maintainers; [ davidak ];
platforms = platforms.all;
description = "Speech synthesizer based on the concatenation of diphones";
homepage = "https://github.com/numediart/MBROLA";
};
# Very big (0.65 G) so kept as a fixed-output derivation to limit "duplicates".
voices = fetchFromGitHub {
owner = "numediart";
repo = "MBROLA-voices";
rev = "fe05a0ccef6a941207fd6aaad0b31294a1f93a51"; # using latest commit
sha256 = "1w0y2xjp9rndwdjagp2wxh656mdm3d6w9cs411g27rjyfy1205a0";
name = "${pname}-voices-${version}";
meta = meta // {
description = "Speech synthesizer based on the concatenation of diphones (voice files)";
homepage = "https://github.com/numediart/MBROLA-voices";
};
};
bin = stdenv.mkDerivation {
pname = "${pname}-bin";
inherit version;
src = fetchFromGitHub {
owner = "numediart";
repo = "MBROLA";
rev = version;
sha256 = "1w86gv6zs2cbr0731n49z8v6xxw0g8b0hzyv2iqb9mqcfh38l8zy";
};
# required for cross compilation
makeFlags = [ "CC=${stdenv.cc.targetPrefix}cc" ];
installPhase = ''
runHook preInstall
install -D Bin/mbrola $out/bin/mbrola
rm -rf $out/share/mbrola/voices/*
runHook postInstall
'';
meta = meta // {
description = "Speech synthesizer based on the concatenation of diphones (binary only)";
};
};
in
runCommandLocal
"${pname}-${version}"
{
inherit pname version meta;
}
''
mkdir -p "$out/share/mbrola"
ln -s '${voices}/data' "$out/share/mbrola/voices"
ln -s '${bin}/bin' "$out/"
''