nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ lib
2, stdenv
3, fetchFromGitHub
4, fetchpatch
5, cmake
6, pkg-config
7, makeWrapper
8, boost
9, portmidi
10, sqlite
11, freetype
12, libpng
13, pngpp
14, zlib
15, wxGTK32
16, wxsqlite3
17, fluidsynth
18, fontconfig
19, darwin
20, soundfont-fluid
21, openlilylib-fonts
22}:
23
24let
25 inherit (darwin.apple_sdk.frameworks) Cocoa;
26in
27stdenv.mkDerivation rec {
28 pname = "lenmus";
29 version = "6.0.1";
30
31 src = fetchFromGitHub {
32 owner = "lenmus";
33 repo = "lenmus";
34 rev = "Release_${version}";
35 sha256 = "sha256-qegOAc6vs2+6VViDHVjv0q+qjLZyTT7yPF3hFpTt5zE=";
36 };
37
38 postPatch = ''
39 substituteInPlace CMakeLists.txt \
40 --replace "/usr" "${placeholder "out"}"
41 sed -i 's/fixup_bundle.*")/")/g' CMakeLists.txt
42 '';
43
44 nativeBuildInputs = [
45 cmake
46 pkg-config
47 ] ++ lib.optionals stdenv.isDarwin [
48 makeWrapper
49 ];
50
51 buildInputs = [
52 boost
53 portmidi
54 sqlite
55 freetype
56 libpng
57 pngpp
58 zlib
59 wxGTK32
60 wxsqlite3
61 fluidsynth
62 fontconfig
63 ] ++ lib.optionals stdenv.isDarwin [
64 Cocoa
65 ];
66
67 preConfigure = ''
68 mkdir res/fonts
69 ln -s ${openlilylib-fonts.bravura}/share/lilypond/*/fonts/otf/Bravura.otf res/fonts/Bravura.otf
70 ln -s ${soundfont-fluid}/share/soundfonts/FluidR3_GM2-2.sf2 res/sounds/FluidR3_GM.sf2
71 '';
72
73 cmakeFlags = [
74 "-DCMAKE_INSTALL_PREFIX=${placeholder "out"}"
75 "-DLENMUS_INSTALL_SOUNDFONT=ON"
76 "-DMAN_INSTALL_DIR=${placeholder "out"}/share/man"
77 ];
78
79 postInstall = lib.optionalString stdenv.isDarwin ''
80 mkdir -p $out/{Applications,bin}
81 mv $out/lenmus.app $out/Applications
82 mv $out/Resources $out/Applications/lenmus.app/Contents
83 makeWrapper $out/{Applications/lenmus.app/Contents/MacOS,bin}/lenmus
84 '';
85
86 meta = with lib; {
87 description = "LenMus Phonascus is a program for learning music";
88 longDescription = ''
89 LenMus Phonascus is a free open source program (GPL v3) for learning music.
90 It allows you to focus on specific skills and exercises, on both theory and aural training.
91 The different activities can be customized to meet your needs
92 '';
93 homepage = "http://www.lenmus.org/";
94 license = licenses.gpl3Plus;
95 maintainers = with maintainers; [ ramkromberg ];
96 platforms = with platforms; unix;
97 };
98}