nixpkgs/pkgs/applications/audio/midisheetmusic/default.nix
Profpatsch 4a7f99d55d treewide: with stdenv.lib; in meta -> with lib;
Part of: https://github.com/NixOS/nixpkgs/issues/108938

meta = with stdenv.lib;

is a widely used pattern. We want to slowly remove
the `stdenv.lib` indirection and encourage people
to use `lib` directly. Thus let’s start with the meta
field.

This used a rewriting script to mostly automatically
replace all occurances of this pattern, and add the
`lib` argument to the package header if it doesn’t
exist yet.

The script in its current form is available at
https://cs.tvl.fyi/depot@2f807d7f141068d2d60676a89213eaa5353ca6e0/-/blob/users/Profpatsch/nixpkgs-rewriter/default.nix
2021-01-11 10:38:22 +01:00

63 lines
2.0 KiB
Nix

{ lib, stdenv, fetchurl
, mono, dotnetPackages, makeWrapper
, gtk2, cups, timidity }:
let
version = "2.6";
in stdenv.mkDerivation {
pname = "midisheetmusic";
inherit version;
src = fetchurl {
url = "mirror://sourceforge/midisheetmusic/MidiSheetMusic-${version}-linux-src.tar.gz";
sha256 = "05c6zskj50g29f51lx8fvgzsi3f31z01zj6ssjjrgr7jfs7ak70p";
};
checkInputs = (with dotnetPackages; [ NUnitConsole ]);
nativeBuildInputs = [ mono makeWrapper ];
buildPhase = ''
for i in Classes/MidiPlayer.cs Classes/MidiSheetMusic.cs
do
substituteInPlace $i --replace "/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
checkPhase = ''
substituteInPlace UnitTestDLL.csproj \
--replace "</Compile>" '</Compile><Compile Include="Classes\UnitTest.cs"/>' \
--replace nunit.framework.dll "${dotnetPackages.NUnit}/lib/dotnet/NUnit/nunit.framework.dll"
./build_unit_test.sh
nunit3-console bin/Debug/UnitTest.dll
'';
# 2 tests of 47 are still failing
doCheck = false;
installPhase = ''
mkdir -p $out/share/applications $out/share/pixmaps $out/bin
cp deb/midisheetmusic.desktop $out/share/applications
cp NotePair.png $out/share/pixmaps/midisheetmusic.png
cp bin/Debug/MidiSheetMusic.exe $out/bin/.MidiSheetMusic.exe
makeWrapper ${mono}/bin/mono $out/bin/midisheetmusic.mono.exe \
--prefix LD_LIBRARY_PATH : ${stdenv.lib.makeLibraryPath [ gtk2 cups ]} \
--prefix PATH : ${stdenv.lib.makeBinPath [ timidity ]} \
--add-flags $out/bin/.MidiSheetMusic.exe
'';
meta = with lib; {
description = "Convert MIDI Files to Piano Sheet Music for two hands";
homepage = "http://midisheetmusic.com";
license = licenses.gpl2;
maintainers = [ maintainers.gnidorah ];
platforms = platforms.linux;
};
}