makeFontsConf: add impureFontDirectories argument
This commit is contained in:
parent
ffe149b1c4
commit
9de711cf62
2 changed files with 26 additions and 15 deletions
|
@ -1,16 +1,29 @@
|
||||||
{ runCommand, stdenv, lib, libxslt, fontconfig, dejavu_fonts, fontDirectories }:
|
{ runCommand, stdenv, lib, libxslt, fontconfig, dejavu_fonts, fontDirectories
|
||||||
|
, impureFontDirectories ? [
|
||||||
|
# nix user profile
|
||||||
|
"~/.nix-profile/lib/X11/fonts" "~/.nix-profile/share/fonts"
|
||||||
|
]
|
||||||
|
++ lib.optional stdenv.isDarwin "~/Library/Fonts"
|
||||||
|
++ [
|
||||||
|
# FHS paths for non-NixOS platforms
|
||||||
|
"/usr/share/fonts" "/usr/local/share/fonts"
|
||||||
|
]
|
||||||
|
# darwin paths
|
||||||
|
++ lib.optionals stdenv.isDarwin [ "/Library/Fonts" "/System/Library/Fonts" ]
|
||||||
|
# nix default profile
|
||||||
|
++ [ "/nix/var/nix/profiles/default/lib/X11/fonts" "/nix/var/nix/profiles/default/share/fonts" ] }:
|
||||||
|
|
||||||
runCommand "fonts.conf"
|
runCommand "fonts.conf"
|
||||||
{
|
{
|
||||||
nativeBuildInputs = [ libxslt ];
|
nativeBuildInputs = [ libxslt ];
|
||||||
buildInputs = [ fontconfig ];
|
buildInputs = [ fontconfig ];
|
||||||
|
inherit fontDirectories;
|
||||||
# Add a default font for non-nixos systems, <1MB and in nixos defaults.
|
# Add a default font for non-nixos systems, <1MB and in nixos defaults.
|
||||||
fontDirectories = fontDirectories ++ [ dejavu_fonts.minimal ]
|
impureFontDirectories = impureFontDirectories ++ [ dejavu_fonts.minimal ];
|
||||||
# further non-nixos fonts on darwin
|
|
||||||
++ lib.optionals stdenv.isDarwin [ "/System/Library/Fonts" "/Library/Fonts" "~/Library/Fonts" ];
|
|
||||||
}
|
}
|
||||||
''
|
''
|
||||||
xsltproc --stringparam fontDirectories "$fontDirectories" \
|
xsltproc --stringparam fontDirectories "$fontDirectories" \
|
||||||
|
--stringparam impureFontDirectories "$impureFontDirectories" \
|
||||||
--path ${fontconfig.out}/share/xml/fontconfig \
|
--path ${fontconfig.out}/share/xml/fontconfig \
|
||||||
${./make-fonts-conf.xsl} ${fontconfig.out}/etc/fonts/fonts.conf \
|
${./make-fonts-conf.xsl} ${fontconfig.out}/etc/fonts/fonts.conf \
|
||||||
> $out
|
> $out
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
<xsl:output method='xml' encoding="UTF-8" doctype-system="urn:fontconfig:fonts.dtd" />
|
<xsl:output method='xml' encoding="UTF-8" doctype-system="urn:fontconfig:fonts.dtd" />
|
||||||
|
|
||||||
<xsl:param name="fontDirectories" />
|
<xsl:param name="fontDirectories" />
|
||||||
|
<xsl:param name="impureFontDirectories" />
|
||||||
|
|
||||||
<xsl:template match="/fontconfig">
|
<xsl:template match="/fontconfig">
|
||||||
|
|
||||||
|
@ -23,29 +24,26 @@
|
||||||
|
|
||||||
<!-- the first cachedir will be used to store the cache -->
|
<!-- the first cachedir will be used to store the cache -->
|
||||||
<cachedir prefix="xdg">fontconfig</cachedir>
|
<cachedir prefix="xdg">fontconfig</cachedir>
|
||||||
|
<xsl:text>
</xsl:text>
|
||||||
<!-- /var/cache/fontconfig is useful for non-nixos systems -->
|
<!-- /var/cache/fontconfig is useful for non-nixos systems -->
|
||||||
<cachedir>/var/cache/fontconfig</cachedir>
|
<cachedir>/var/cache/fontconfig</cachedir>
|
||||||
|
<xsl:text>
</xsl:text>
|
||||||
|
|
||||||
<!-- system-wide config -->
|
<!-- system-wide config -->
|
||||||
<include ignore_missing="yes">/etc/fonts/conf.d</include>
|
<include ignore_missing="yes">/etc/fonts/conf.d</include>
|
||||||
|
<xsl:text>
</xsl:text>
|
||||||
|
|
||||||
<dir prefix="xdg">fonts</dir>
|
<dir prefix="xdg">fonts</dir>
|
||||||
|
<xsl:text>
</xsl:text>
|
||||||
<xsl:for-each select="str:tokenize($fontDirectories)">
|
<xsl:for-each select="str:tokenize($fontDirectories)">
|
||||||
<dir><xsl:value-of select="." /></dir>
|
<dir><xsl:value-of select="." /></dir>
|
||||||
<xsl:text>
</xsl:text>
|
<xsl:text>
</xsl:text>
|
||||||
</xsl:for-each>
|
</xsl:for-each>
|
||||||
|
|
||||||
<!-- nix user profile -->
|
<xsl:for-each select="str:tokenize($impureFontDirectories)">
|
||||||
<dir>~/.nix-profile/lib/X11/fonts</dir>
|
<dir><xsl:value-of select="." /></dir>
|
||||||
<dir>~/.nix-profile/share/fonts</dir>
|
<xsl:text>
</xsl:text>
|
||||||
|
</xsl:for-each>
|
||||||
<!-- FHS paths for non-NixOS platforms -->
|
|
||||||
<dir>/usr/share/fonts</dir>
|
|
||||||
<dir>/usr/local/share/fonts</dir>
|
|
||||||
|
|
||||||
<!-- nix default profile -->
|
|
||||||
<dir>/nix/var/nix/profiles/default/lib/X11/fonts</dir>
|
|
||||||
<dir>/nix/var/nix/profiles/default/share/fonts</dir>
|
|
||||||
|
|
||||||
</fontconfig>
|
</fontconfig>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue