{ runCommand, lib, fontconfig, fontDirectories, stdenv, buildPackages }: let # Use a build-platform fc-cache when cross-compiling to avoid Exec format errors. fc = if stdenv.buildPlatform != stdenv.hostPlatform then buildPackages.fontconfig else fontconfig; in runCommand "fc-cache" { nativeBuildInputs = [ fc.bin ]; preferLocalBuild = true; allowSubstitutes = false; passAsFile = [ "fontDirs" ]; fontDirs = '' ${lib.concatStringsSep "\n" (map (font: "