···
7
-
fontDirs = config.fonts.fonts;
9
-
localDefs = with pkgs.builderDefs; pkgs.builderDefs.passthru.function rec {
10
-
src = "";/* put a fetchurl here */
11
-
buildInputs = [pkgs.xorg.mkfontdir pkgs.xorg.mkfontscale];
13
-
installPhase = fullDepEntry ("
15
-
for i in ${toString fontDirs} ; do
16
-
if [ -d \$i/ ]; then
17
-
list=\"\$list \$i\";
20
-
list=\$(find \$list -name fonts.dir -o -name '*.ttf' -o -name '*.otf');
22
-
for i in \$list ; do
23
-
fontDirs=\"\$fontDirs \$(dirname \$i)\";
25
-
mkdir -p \$out/share/X11-fonts/;
26
-
find \$fontDirs -type f -o -type l | while read i; do
28
-
if ! test -e \"\$out/share/X11-fonts/\${j}\"; then
29
-
ln -s \"\$i\" \"\$out/share/X11-fonts/\${j}\";
32
-
cd \$out/share/X11-fonts/
38
-
cat \$( find ${pkgs.xorg.fontalias}/ -name fonts.alias) >fonts.alias
39
-
") ["minInit" "addInputs"];
42
-
x11Fonts = with localDefs; stdenv.mkDerivation rec {
44
-
builder = writeScript (name + "-builder")
45
-
(textClosure localDefs
46
-
[installPhase doForceShare doPropagate]);
7
+
x11Fonts = pkgs.runCommand "X11-fonts" { } ''
8
+
mkdir -p "$out/share/X11-fonts"
9
+
find ${toString config.fonts.fonts} \
10
+
\( -name fonts.dir -o -name '*.ttf' -o -name '*.otf' \) \
11
+
-exec ln -sf -t "$out/share/X11-fonts" '{}' \;
12
+
cd "$out/share/X11-fonts"
13
+
rm -f fonts.dir fonts.scale fonts.alias
14
+
${pkgs.xorg.mkfontdir}/bin/mkfontdir
15
+
${pkgs.xorg.mkfontscale}/bin/mkfontscale
16
+
cat $(find ${pkgs.xorg.fontalias}/ -name fonts.alias) >fonts.alias
···
config = mkIf config.fonts.enableFontDir {
environment.systemPackages = [ x11Fonts ];
43
+
environment.pathsToLink = [ "/share/X11-fonts" ];