diff --git a/pkgs/by-name/mi/midisheetmusic/package.nix b/pkgs/by-name/mi/midisheetmusic/package.nix
index 211e012b7e8a..b5cce6f2adaf 100644
--- a/pkgs/by-name/mi/midisheetmusic/package.nix
+++ b/pkgs/by-name/mi/midisheetmusic/package.nix
@@ -3,14 +3,33 @@
stdenv,
fetchurl,
mono,
- dotnetPackages,
+ mkNugetDeps,
makeWrapper,
+ makeFontsConf,
gtk2,
cups,
timidity,
}:
let
+ deps = mkNugetDeps {
+ name = "midisheetmusic-deps";
+ nugetDeps =
+ { fetchNuGet }:
+ [
+ (fetchNuGet {
+ pname = "NUnit.Console";
+ version = "3.0.1";
+ hash = "sha256-FkzpEk12msmUp5I05ZzlGiG+UInoYhBmar/vB5Gt4H8=";
+ })
+ (fetchNuGet {
+ pname = "NUnit";
+ version = "2.6.4";
+ hash = "sha256-Kkft3QO9T5WwsvyPRNGT2nut7RS7OWArDjIYxvwA8qU=";
+ })
+ ];
+ };
+
version = "2.6";
in
stdenv.mkDerivation {
@@ -22,7 +41,6 @@ stdenv.mkDerivation {
sha256 = "05c6zskj50g29f51lx8fvgzsi3f31z01zj6ssjjrgr7jfs7ak70p";
};
- nativeCheckInputs = (with dotnetPackages; [ NUnitConsole ]);
nativeBuildInputs = [
mono
makeWrapper
@@ -31,25 +49,32 @@ stdenv.mkDerivation {
buildPhase = ''
for i in Classes/MidiPlayer.cs Classes/MidiSheetMusic.cs
do
- substituteInPlace $i --replace "/usr/bin/timidity" "${timidity}/bin/timidity"
+ substituteInPlace $i --replace-fail "/usr/bin/timidity" "${timidity}/bin/timidity"
done
./build.sh
'';
- # include missing file with unit tests for building
- # switch from mono nunit dll to standalone dll otherwise mono compiler barks
- # run via nunit3 console, because mono nunit console wants access $HOME
+ doCheck = true;
+
checkPhase = ''
+ # Resolves the warning "Fontconfig error: No writable cache directories"
+ export XDG_CACHE_HOME="$(mktemp -d)"
+
+ # Adds one file with tests that's missing from compiliation
+ # Makes sure NUnit framework from NuGet can be found
substituteInPlace UnitTestDLL.csproj \
- --replace "" '' \
- --replace nunit.framework.dll "${dotnetPackages.NUnit}/lib/dotnet/NUnit/nunit.framework.dll"
+ --replace-fail '' '' \
+ --replace-fail 'nunit.framework.dll' '${deps}/share/nuget/packages/nunit/2.6.4/lib/nunit.framework.dll'
./build_unit_test.sh
- nunit3-console bin/Debug/UnitTest.dll
+
+ # 2 tests are still failing, we exclude them for now
+ mono ${deps}/share/nuget/packages/nunit.console/3.0.1/tools/nunit3-console.exe bin/Debug/UnitTest.dll \
+ --where "test != 'MidiFileTest.TestChangeSoundTrack' && test != 'MidiFileTest.TestChangeSoundPerChannelTracks'"
'';
- # 2 tests of 47 are still failing
- doCheck = false;
+ # This fixes tests that fail because of missing fonts
+ FONTCONFIG_FILE = makeFontsConf { fontDirectories = [ ]; };
installPhase = ''
mkdir -p $out/share/applications $out/share/pixmaps $out/bin
@@ -69,12 +94,12 @@ stdenv.mkDerivation {
--add-flags $out/bin/.MidiSheetMusic.exe
'';
- meta = with lib; {
+ meta = {
description = "Convert MIDI Files to Piano Sheet Music for two hands";
mainProgram = "midisheetmusic.mono.exe";
homepage = "http://midisheetmusic.com";
- license = licenses.gpl2;
- maintainers = [ ];
- platforms = platforms.linux;
+ license = lib.licenses.gpl2;
+ maintainers = [ lib.maintainers.mdarocha ];
+ platforms = lib.platforms.linux;
};
}