1{
2 stdenv,
3 lib,
4 fetchzip,
5 ghostscript,
6 texinfo,
7 imagemagick,
8 texi2html,
9 extractpdfmark,
10 guile,
11 python3,
12 gettext,
13 glib,
14 gmp,
15 flex,
16 perl,
17 bison,
18 pkg-config,
19 autoreconfHook,
20 dblatex,
21 fontconfig,
22 freetype,
23 pango,
24 fontforge,
25 help2man,
26 freefont_ttf,
27 makeFontsConf,
28 makeWrapper,
29 t1utils,
30 boehmgc,
31 rsync,
32 coreutils,
33 texliveSmall,
34 tex ? texliveSmall.withPackages (
35 ps: with ps; [
36 epsf
37 fontinst
38 fontware
39 lh
40 metafont
41 ]
42 ),
43}:
44
45stdenv.mkDerivation rec {
46 pname = "lilypond";
47 version = "2.24.4";
48
49 src = fetchzip {
50 url = "http://lilypond.org/download/sources/v${lib.versions.majorMinor version}/lilypond-${version}.tar.gz";
51 hash = "sha256-UYdORvodrVchxslOxpMiXrAh7DtB9sWp9yqZU/jeB9Y=";
52 };
53
54 postInstall = ''
55 for f in "$out/bin/"*; do
56 # Override default argv[0] setting so LilyPond can find
57 # its Scheme libraries.
58 wrapProgram "$f" \
59 --set GUILE_AUTO_COMPILE 0 \
60 --prefix PATH : "${
61 lib.makeBinPath [
62 ghostscript
63 coreutils
64 (placeholder "out")
65 ]
66 }" \
67 --argv0 "$f"
68 done
69 '';
70
71 preConfigure = ''
72 substituteInPlace scripts/build/mf2pt1.pl \
73 --replace-fail "mem=mf2pt1" "mem=$PWD/mf/mf2pt1"
74 '';
75
76 strictDeps = true;
77
78 depsBuildBuild = [
79 pkg-config
80 ];
81
82 nativeBuildInputs = [
83 autoreconfHook
84 bison
85 dblatex
86 extractpdfmark
87 flex # for flex binary
88 fontconfig
89 fontforge
90 gettext
91 ghostscript
92 guile
93 help2man
94 imagemagick
95 makeWrapper
96 perl
97 pkg-config
98 python3
99 rsync
100 t1utils
101 tex
102 texi2html
103 texinfo
104 ];
105
106 buildInputs = [
107 boehmgc
108 flex # FlexLexer.h
109 freetype
110 glib
111 gmp
112 pango
113 ];
114
115 autoreconfPhase = "NOCONFIGURE=1 sh autogen.sh";
116
117 enableParallelBuilding = true;
118
119 passthru.updateScript = {
120 command = [ ./update.sh ];
121 supportedFeatures = [ "commit" ];
122 };
123
124 # documentation makefile uses "out" for different purposes, hence we explicitly set it to an empty string
125 makeFlags = [ "out=" ];
126
127 meta = {
128 description = "Music typesetting system";
129 homepage = "https://lilypond.org/";
130 license = with lib.licenses; [
131 gpl3Plus # most code
132 gpl3Only # ly/articulate.ly
133 fdl13Plus # docs
134 ofl # mf/
135 ];
136 maintainers = with lib.maintainers; [
137 marcweber
138 yurrriq
139 ];
140 platforms = lib.platforms.all;
141 };
142
143 FONTCONFIG_FILE = lib.optional stdenv.hostPlatform.isDarwin (makeFontsConf {
144 fontDirectories = [ freefont_ttf ];
145 });
146}