depot/pkgs/applications/audio/openutau/default.nix
Luke Granger-Brown 57725ef3ec Squashed 'third_party/nixpkgs/' content from commit 76612b17c0ce
git-subtree-dir: third_party/nixpkgs
git-subtree-split: 76612b17c0ce71689921ca12d9ffdc9c23ce40b2
2024-11-10 23:59:47 +00:00

87 lines
2.7 KiB
Nix

{ lib
, stdenv
, buildDotnetModule
, fetchFromGitHub
, dotnetCorePackages
, dbus
, fontconfig
, portaudio
}:
buildDotnetModule rec {
pname = "OpenUtau";
version = "0.1.529";
src = fetchFromGitHub {
owner = "stakira";
repo = "OpenUtau";
rev = "build/${version}";
hash = "sha256-HE0KxPKU7tYZbYiCL8sm6I/NZiX0MJktt+5d6qB1A2E=";
};
dotnet-sdk = dotnetCorePackages.sdk_7_0;
dotnet-runtime = dotnetCorePackages.runtime_7_0;
# [...]/Microsoft.NET.Sdk.targets(157,5): error MSB4018: The "GenerateDepsFile" task failed unexpectedly. [[...]/OpenUtau.Core.csproj]
# [...]/Microsoft.NET.Sdk.targets(157,5): error MSB4018: System.IO.IOException: The process cannot access the file '[...]/OpenUtau.Core.deps.json' because it is being used by another process. [[...]/OpenUtau.Core.csproj]
enableParallelBuilding = false;
projectFile = "OpenUtau.sln";
nugetDeps = ./deps.nix;
executables = [ "OpenUtau" ];
runtimeDeps = [
dbus
portaudio
];
dotnetInstallFlags = [ "-p:PublishReadyToRun=false" ];
# socket cannot bind to localhost on darwin for tests
doCheck = !stdenv.hostPlatform.isDarwin;
# net7.0 replacement needed until upstream bumps to dotnet 7
postPatch = ''
substituteInPlace OpenUtau/OpenUtau.csproj OpenUtau.Test/OpenUtau.Test.csproj --replace \
'<TargetFramework>net6.0</TargetFramework>' \
'<TargetFramework>net7.0</TargetFramework>'
substituteInPlace OpenUtau/Program.cs --replace \
'/usr/bin/fc-match' \
'${lib.getExe' fontconfig "fc-match"}'
'';
# need to make sure proprietary worldline resampler is copied
postInstall = let
runtime = if (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isx86_64) then "linux-x64"
else if (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch64) then "linux-arm64"
else if stdenv.hostPlatform.isDarwin then "osx"
else null;
in lib.optionalString (runtime != null) ''
cp runtimes/${runtime}/native/libworldline${stdenv.hostPlatform.extensions.sharedLibrary} $out/lib/OpenUtau/
'';
passthru.updateScript = ./update.sh;
meta = with lib; {
description = "Open source singing synthesis platform and UTAU successor";
homepage = "http://www.openutau.com/";
sourceProvenance = with sourceTypes; [
fromSource
# deps
binaryBytecode
# some deps and worldline resampler
binaryNativeCode
];
license = with licenses; [
# dotnet code and worldline resampler binary
mit
# worldline resampler binary - no source is available (hence "unfree") but usage of the binary is MIT
unfreeRedistributable
];
maintainers = [ ];
platforms = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
mainProgram = "OpenUtau";
};
}