config.fonts.fontdir: use runCommand instead of builderDefs

The primary motivation here is to get rid of builderDefs, but now the
resulting font directory is also linked into /run/current-system/sw,
which fixes #15194.
This commit is contained in:
Joachim Fasting 2016-05-25 19:10:16 +02:00
parent 8479e0ad84
commit b24e58a82b
No known key found for this signature in database
GPG Key ID: 4330820E1E04DCF4

View File

@ -4,47 +4,17 @@ with lib;
let let
fontDirs = config.fonts.fonts; x11Fonts = pkgs.runCommand "X11-fonts" { } ''
mkdir -p "$out/share/X11-fonts"
localDefs = with pkgs.builderDefs; pkgs.builderDefs.passthru.function rec { find ${toString config.fonts.fonts} \
src = "";/* put a fetchurl here */ \( -name fonts.dir -o -name '*.ttf' -o -name '*.otf' \) \
buildInputs = [pkgs.xorg.mkfontdir pkgs.xorg.mkfontscale]; -exec ln -sf -t "$out/share/X11-fonts" '{}' \;
inherit fontDirs; cd "$out/share/X11-fonts"
installPhase = fullDepEntry (" rm -f fonts.dir fonts.scale fonts.alias
list=''; ${pkgs.xorg.mkfontdir}/bin/mkfontdir
for i in ${toString fontDirs} ; do ${pkgs.xorg.mkfontscale}/bin/mkfontscale
if [ -d \$i/ ]; then cat $(find ${pkgs.xorg.fontalias}/ -name fonts.alias) >fonts.alias
list=\"\$list \$i\"; '';
fi;
done
list=\$(find \$list -name fonts.dir -o -name '*.ttf' -o -name '*.otf');
fontDirs='';
for i in \$list ; do
fontDirs=\"\$fontDirs \$(dirname \$i)\";
done;
mkdir -p \$out/share/X11-fonts/;
find \$fontDirs -type f -o -type l | while read i; do
j=\"\${i##*/}\"
if ! test -e \"\$out/share/X11-fonts/\${j}\"; then
ln -s \"\$i\" \"\$out/share/X11-fonts/\${j}\";
fi;
done;
cd \$out/share/X11-fonts/
rm fonts.dir
rm fonts.scale
rm fonts.alias
mkfontdir
mkfontscale
cat \$( find ${pkgs.xorg.fontalias}/ -name fonts.alias) >fonts.alias
") ["minInit" "addInputs"];
};
x11Fonts = with localDefs; stdenv.mkDerivation rec {
name = "X11-fonts";
builder = writeScript (name + "-builder")
(textClosure localDefs
[installPhase doForceShare doPropagate]);
};
in in
@ -70,6 +40,8 @@ in
environment.systemPackages = [ x11Fonts ]; environment.systemPackages = [ x11Fonts ];
environment.pathsToLink = [ "/share/X11-fonts" ];
}; };
} }