From 9de711cf62e9a5093b414cbbaca36747ce6f937a Mon Sep 17 00:00:00 2001
From: Vincenzo Mantova <1962985+xworld21@users.noreply.github.com>
Date: Sun, 26 Nov 2023 19:41:02 +0000
Subject: [PATCH] makeFontsConf: add impureFontDirectories argument
---
.../libraries/fontconfig/make-fonts-conf.nix | 21 +++++++++++++++----
.../libraries/fontconfig/make-fonts-conf.xsl | 20 ++++++++----------
2 files changed, 26 insertions(+), 15 deletions(-)
diff --git a/pkgs/development/libraries/fontconfig/make-fonts-conf.nix b/pkgs/development/libraries/fontconfig/make-fonts-conf.nix
index aa84de4dcecd..cfe0a21e1d35 100644
--- a/pkgs/development/libraries/fontconfig/make-fonts-conf.nix
+++ b/pkgs/development/libraries/fontconfig/make-fonts-conf.nix
@@ -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"
{
nativeBuildInputs = [ libxslt ];
buildInputs = [ fontconfig ];
+ inherit fontDirectories;
# Add a default font for non-nixos systems, <1MB and in nixos defaults.
- fontDirectories = fontDirectories ++ [ dejavu_fonts.minimal ]
- # further non-nixos fonts on darwin
- ++ lib.optionals stdenv.isDarwin [ "/System/Library/Fonts" "/Library/Fonts" "~/Library/Fonts" ];
+ impureFontDirectories = impureFontDirectories ++ [ dejavu_fonts.minimal ];
}
''
xsltproc --stringparam fontDirectories "$fontDirectories" \
+ --stringparam impureFontDirectories "$impureFontDirectories" \
--path ${fontconfig.out}/share/xml/fontconfig \
${./make-fonts-conf.xsl} ${fontconfig.out}/etc/fonts/fonts.conf \
> $out
diff --git a/pkgs/development/libraries/fontconfig/make-fonts-conf.xsl b/pkgs/development/libraries/fontconfig/make-fonts-conf.xsl
index ed51b62a1d08..d04e4ffab967 100644
--- a/pkgs/development/libraries/fontconfig/make-fonts-conf.xsl
+++ b/pkgs/development/libraries/fontconfig/make-fonts-conf.xsl
@@ -15,6 +15,7 @@
+
@@ -23,29 +24,26 @@
fontconfig
+
/var/cache/fontconfig
+
/etc/fonts/conf.d
+
fonts
+
-
- ~/.nix-profile/lib/X11/fonts
- ~/.nix-profile/share/fonts
-
-
- /usr/share/fonts
- /usr/local/share/fonts
-
-
- /nix/var/nix/profiles/default/lib/X11/fonts
- /nix/var/nix/profiles/default/share/fonts
+
+
+
+