git.iko.soy/typeable/nixpkgs
on master help sign in
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.

commitb24e58a82ba3323ca0aa4db80a80e7725c7ff21d authorJoachim Fasting <joachifm@fastmail.fm> dateWed 25 May 2016, 19:10 (11 years ago) parent8479e0a
1 file changed+13−41
nixos/modules/config/fonts/fontdir.nix+13−41
nixos/modules/config/fonts/fontdir.nix+13−41
@@ -4,47 +4,17 @@ with lib;
44
55let
66
7− fontDirs = config.fonts.fonts;
8−
9− localDefs = with pkgs.builderDefs; pkgs.builderDefs.passthru.function rec {
10− src = "";/* put a fetchurl here */
11− buildInputs = [pkgs.xorg.mkfontdir pkgs.xorg.mkfontscale];
12− inherit fontDirs;
13− installPhase = fullDepEntry ("
14− list='';
15− for i in ${toString fontDirs} ; do
16− if [ -d \$i/ ]; then
17− list=\"\$list \$i\";
18− fi;
19− done
20− list=\$(find \$list -name fonts.dir -o -name '*.ttf' -o -name '*.otf');
21− fontDirs='';
22− for i in \$list ; do
23− fontDirs=\"\$fontDirs \$(dirname \$i)\";
24− done;
25− mkdir -p \$out/share/X11-fonts/;
26− find \$fontDirs -type f -o -type l | while read i; do
27− j=\"\${i##*/}\"
28− if ! test -e \"\$out/share/X11-fonts/\${j}\"; then
29− ln -s \"\$i\" \"\$out/share/X11-fonts/\${j}\";
30− fi;
31− done;
32− cd \$out/share/X11-fonts/
33− rm fonts.dir
34− rm fonts.scale
35− rm fonts.alias
36− mkfontdir
37− mkfontscale
38− cat \$( find ${pkgs.xorg.fontalias}/ -name fonts.alias) >fonts.alias
39− ") ["minInit" "addInputs"];
40− };
41−
42− x11Fonts = with localDefs; stdenv.mkDerivation rec {
43− name = "X11-fonts";
44− builder = writeScript (name + "-builder")
45− (textClosure localDefs
46− [installPhase doForceShare doPropagate]);
47− };
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
17+ '';
4818
4919in
5020
@@ -70,6 +40,8 @@ in
7040
7141 environment.systemPackages = [ x11Fonts ];
7242
43+ environment.pathsToLink = [ "/share/X11-fonts" ];
44+
7345 };
7446
7547}