diff --git a/system/etc.nix b/system/etc.nix
index 917491fcb1da..5f5d1e8da59b 100644
--- a/system/etc.nix
+++ b/system/etc.nix
@@ -79,7 +79,18 @@ import ../helpers/make-etc.nix {
{ # Configuration file for fontconfig used to locate
# (X11) client-rendered fonts.
- source = ./etc/fonts/fonts.conf;
+ source = pkgs.substituteAll {
+ src = ./etc/fonts/fonts.conf;
+ fontDirectories = map (dir: "
${dir}")
+ [ # Search for fonts in...
+ # - the user's .fonts directory
+ "~/.fonts"
+ # - the user's current profile
+ "~/.nix-profile/lib/X11/fonts"
+ # - the default profile
+ "/nix/var/nix/profiles/default/lib/X11/fonts"
+ ];
+ };
target = "fonts/fonts.conf";
}
diff --git a/system/etc/fonts/fonts.conf b/system/etc/fonts/fonts.conf
index ff4a608e9285..012a3008a57e 100644
--- a/system/etc/fonts/fonts.conf
+++ b/system/etc/fonts/fonts.conf
@@ -3,8 +3,6 @@
- /nix/var/nix/profiles/default/lib/X11/fonts
- ~/.nix-profile/lib/X11/fonts
- ~/.fonts
+ @fontDirectories@