at 18.09-beta 977 B view raw
1{ config, lib, pkgs, ... }: 2 3with lib; 4 5let 6 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 ''; 18 19in 20 21{ 22 23 options = { 24 25 fonts = { 26 27 enableFontDir = mkOption { 28 default = false; 29 description = '' 30 Whether to create a directory with links to all fonts in 31 <filename>/run/current-system/sw/share/X11-fonts</filename>. 32 ''; 33 }; 34 35 }; 36 37 }; 38 39 config = mkIf config.fonts.enableFontDir { 40 41 environment.systemPackages = [ x11Fonts ]; 42 43 environment.pathsToLink = [ "/share/X11-fonts" ]; 44 45 }; 46 47}