33 stdenv ,
44 fetchurl ,
55 mono ,
6- dotnetPackages ,
6+ mkNugetDeps ,
77 makeWrapper ,
8+ makeFontsConf ,
89 gtk2 ,
910 cups ,
1011 timidity ,
1112} :
1213
1314let
15+ deps = mkNugetDeps {
16+ name = "midisheetmusic-deps" ;
17+ nugetDeps =
18+ { fetchNuGet } :
19+ [
20+ ( fetchNuGet {
21+ pname = "NUnit.Console" ;
22+ version = "3.0.1" ;
23+ hash = "sha256-FkzpEk12msmUp5I05ZzlGiG+UInoYhBmar/vB5Gt4H8=" ;
24+ } )
25+ ( fetchNuGet {
26+ pname = "NUnit" ;
27+ version = "2.6.4" ;
28+ hash = "sha256-Kkft3QO9T5WwsvyPRNGT2nut7RS7OWArDjIYxvwA8qU=" ;
29+ } )
30+ ] ;
31+ } ;
32+
1433 version = "2.6" ;
1534in
1635stdenv . mkDerivation {
@@ -22,7 +41,6 @@ stdenv.mkDerivation {
2241 sha256 = "05c6zskj50g29f51lx8fvgzsi3f31z01zj6ssjjrgr7jfs7ak70p" ;
2342 } ;
2443
25- nativeCheckInputs = ( with dotnetPackages ; [ NUnitConsole ] ) ;
2644 nativeBuildInputs = [
2745 mono
2846 makeWrapper
@@ -31,25 +49,32 @@ stdenv.mkDerivation {
3149 buildPhase = ''
3250 for i in Classes/MidiPlayer.cs Classes/MidiSheetMusic.cs
3351 do
34- substituteInPlace $i --replace "/usr/bin/timidity" "${ timidity } /bin/timidity"
52+ substituteInPlace $i --replace-fail "/usr/bin/timidity" "${ timidity } /bin/timidity"
3553 done
3654
3755 ./build.sh
3856 '' ;
3957
40- # include missing file with unit tests for building
41- # switch from mono nunit dll to standalone dll otherwise mono compiler barks
42- # run via nunit3 console, because mono nunit console wants access $HOME
58+ doCheck = true ;
59+
4360 checkPhase = ''
61+ # Resolves the warning "Fontconfig error: No writable cache directories"
62+ export XDG_CACHE_HOME="$(mktemp -d)"
63+
64+ # Adds one file with tests that's missing from compiliation
65+ # Makes sure NUnit framework from NuGet can be found
4466 substituteInPlace UnitTestDLL.csproj \
45- --replace " </Compile>" '</Compile><Compile Include="Classes\UnitTest.cs"/>' \
46- --replace nunit.framework.dll " ${ dotnetPackages . NUnit } /lib/dotnet/NUnit /nunit. framework.dll"
67+ --replace-fail ' </Compile>' '</Compile><Compile Include="Classes\UnitTest.cs"/>' \
68+ --replace-fail ' nunit.framework.dll' ' ${ deps } /share/nuget/packages /nunit/2.6.4/lib/nunit. framework.dll'
4769 ./build_unit_test.sh
48- nunit3-console bin/Debug/UnitTest.dll
70+
71+ # 2 tests are still failing, we exclude them for now
72+ mono ${ deps } /share/nuget/packages/nunit.console/3.0.1/tools/nunit3-console.exe bin/Debug/UnitTest.dll \
73+ --where "test != 'MidiFileTest.TestChangeSoundTrack' && test != 'MidiFileTest.TestChangeSoundPerChannelTracks'"
4974 '' ;
5075
51- # 2 tests of 47 are still failing
52- doCheck = false ;
76+ # This fixes tests that fail because of missing fonts
77+ FONTCONFIG_FILE = makeFontsConf { fontDirectories = [ ] ; } ;
5378
5479 installPhase = ''
5580 mkdir -p $out/share/applications $out/share/pixmaps $out/bin
@@ -69,12 +94,12 @@ stdenv.mkDerivation {
6994 --add-flags $out/bin/.MidiSheetMusic.exe
7095 '' ;
7196
72- meta = with lib ; {
97+ meta = {
7398 description = "Convert MIDI Files to Piano Sheet Music for two hands" ;
7499 mainProgram = "midisheetmusic.mono.exe" ;
75100 homepage = "http://midisheetmusic.com" ;
76- license = licenses . gpl2 ;
77- maintainers = [ ] ;
78- platforms = platforms . linux ;
101+ license = lib . licenses . gpl2 ;
102+ maintainers = [ lib . maintainers . mdarocha ] ;
103+ platforms = lib . platforms . linux ;
79104 } ;
80105}
0 commit comments