2023-08-22 20:05:09 +00:00
{ lib
, stdenv
, buildDotnetModule
, fetchFromGitHub
, dotnetCorePackages
, dbus
, fontconfig
, portaudio
} :
buildDotnetModule rec {
pname = " O p e n U t a u " ;
2024-09-19 14:19:46 +00:00
version = " 0 . 1 . 5 2 9 " ;
2023-08-22 20:05:09 +00:00
src = fetchFromGitHub {
owner = " s t a k i r a " ;
repo = " O p e n U t a u " ;
rev = " b u i l d / ${ version } " ;
2024-09-19 14:19:46 +00:00
hash = " s h a 2 5 6 - H E 0 K x P K U 7 t Y Z b Y i C L 8 s m 6 I / N Z i X 0 M J k t t + 5 d 6 q B 1 A 2 E = " ;
2023-08-22 20:05:09 +00:00
} ;
dotnet-sdk = dotnetCorePackages . sdk_7_0 ;
dotnet-runtime = dotnetCorePackages . runtime_7_0 ;
2024-09-19 14:19:46 +00:00
# [...]/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 ;
2023-08-22 20:05:09 +00:00
projectFile = " O p e n U t a u . s l n " ;
nugetDeps = ./deps.nix ;
executables = [ " O p e n U t a u " ] ;
runtimeDeps = [
dbus
portaudio
] ;
dotnetInstallFlags = [ " - p : P u b l i s h R e a d y T o R u n = f a l s e " ] ;
# socket cannot bind to localhost on darwin for tests
doCheck = ! stdenv . isDarwin ;
2024-02-07 01:22:34 +00:00
# net7.0 replacement needed until upstream bumps to dotnet 7
2023-08-22 20:05:09 +00:00
postPatch = ''
substituteInPlace OpenUtau/OpenUtau.csproj OpenUtau.Test/OpenUtau.Test.csproj - - replace \
2023-10-19 13:55:26 +00:00
' <TargetFramework> net6 .0 < /TargetFramework > ' \
' <TargetFramework> net7 .0 < /TargetFramework > '
2024-02-07 01:22:34 +00:00
substituteInPlace OpenUtau/Program.cs - - replace \
' /usr/bin/fc-match ' \
' $ { lib . getExe' fontconfig " f c - m a t c h " } '
2023-08-22 20:05:09 +00:00
'' ;
# need to make sure proprietary worldline resampler is copied
postInstall = let
runtime = if ( stdenv . isLinux && stdenv . isx86_64 ) then " l i n u x - x 6 4 "
else if ( stdenv . isLinux && stdenv . isAarch64 ) then " l i n u x - a r m 6 4 "
else if stdenv . isDarwin then " o s x "
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 = " O p e n s o u r c e s i n g i n g s y n t h e s i s p l a t f o r m a n d U T A U s u c c e s s o r " ;
homepage = " h t t p : / / w w w . o p e n u t a u . c o m / " ;
sourceProvenance = with sourceTypes ; [
fromSource
# deps
binaryBytecode
# some deps and worldline resampler
binaryNativeCode
] ;
license = with licenses ; [
2023-11-16 04:20:00 +00:00
# dotnet code and worldline resampler binary
2023-08-22 20:05:09 +00:00
mit
2023-11-16 04:20:00 +00:00
# worldline resampler binary - no source is available (hence "unfree") but usage of the binary is MIT
unfreeRedistributable
2023-08-22 20:05:09 +00:00
] ;
2024-07-31 10:19:44 +00:00
maintainers = [ ] ;
2023-08-22 20:05:09 +00:00
platforms = [ " x 8 6 _ 6 4 - l i n u x " " a a r c h 6 4 - l i n u x " " x 8 6 _ 6 4 - d a r w i n " " a a r c h 6 4 - d a r w i n " ] ;
2024-02-29 20:09:43 +00:00
mainProgram = " O p e n U t a u " ;
2023-08-22 20:05:09 +00:00
} ;
}