about summary refs log tree commit diff
path: root/nixpkgs/pkgs/misc/lilypond/with-fonts.nix
blob: 5bc74cb65ddf95d5e67c68516c8fa5031f3a977c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
{ stdenv
, lndir
, lilypond
, openlilylib-fonts
, fonts ? openlilylib-fonts.all
}:

stdenv.lib.appendToName "with-fonts" (stdenv.mkDerivation {
  inherit (lilypond) name;
  phases = "installPhase";
  buildInputs = fonts;
  nativeBuildInputs = [ lndir ];
  installPhase = ''
    local fontsdir=$out/share/lilypond/${lilypond.version}/fonts

    install -m755 -d $fontsdir/otf
    install -m755 -d $fontsdir/svg

    ${stdenv.lib.concatMapStrings (font: ''
        lndir -silent ${font}/otf $fontsdir/otf
        lndir -silent ${font}/svg $fontsdir/svg
      '') fonts}

      install -m755 -d $out/lib
      lndir -silent ${lilypond}/lib $out/lib
      install -m755 -d $out/share
      lndir -silent ${lilypond}/share $out/share

      install -m755 -Dt $out/bin ${lilypond}/bin/*

      for p in $out/bin/*; do
        substituteInPlace $p --replace "exec -a \"${lilypond}" "exec -a \"$out"
      done
  '';
})