diff --git a/nixos/modules/config/fonts/fontdir.nix b/nixos/modules/config/fonts/fontdir.nix index 1d47970d131d9..c0ca9d1b537a3 100644 --- a/nixos/modules/config/fonts/fontdir.nix +++ b/nixos/modules/config/fonts/fontdir.nix @@ -8,19 +8,35 @@ let cfg = config.fonts.fontDir; - x11Fonts = pkgs.runCommand "X11-fonts" { preferLocalBuild = true; } '' - mkdir -p "$out/share/X11/fonts" - font_regexp='.*\.\(ttf\|ttc\|otb\|otf\|pcf\|pfa\|pfb\|bdf\)\(\.gz\)?' - find ${toString config.fonts.packages} -regex "$font_regexp" \ - -exec ln -sf -t "$out/share/X11/fonts" '{}' \; - cd "$out/share/X11/fonts" - ${lib.optionalString cfg.decompressFonts '' - ${pkgs.gzip}/bin/gunzip -f *.gz - ''} - ${pkgs.xorg.mkfontscale}/bin/mkfontscale - ${pkgs.xorg.mkfontdir}/bin/mkfontdir - cat $(find ${pkgs.xorg.fontalias}/ -name fonts.alias) >fonts.alias - ''; + x11Fonts = pkgs.callPackage ( + { + runCommand, + gzip, + xorg, + }: + runCommand "X11-fonts" + { + preferLocalBuild = true; + nativeBuildInputs = [ + gzip + xorg.mkfontscale + xorg.mkfontdir + ]; + } + '' + mkdir -p "$out/share/X11/fonts" + font_regexp='.*\.\(ttf\|ttc\|otb\|otf\|pcf\|pfa\|pfb\|bdf\)\(\.gz\)?' + find ${toString config.fonts.packages} -regex "$font_regexp" \ + -exec ln -sf -t "$out/share/X11/fonts" '{}' \; + cd "$out/share/X11/fonts" + ${lib.optionalString cfg.decompressFonts '' + gunzip -f *.gz + ''} + mkfontscale + mkfontdir + cat $(find ${pkgs.xorg.fontalias}/ -name fonts.alias) >fonts.alias + '' + ) { }; in