From 4b7809efffdfed24313c2f0f380aa7373b8000db Mon Sep 17 00:00:00 2001 From: Robert Helgesson Date: Thu, 21 Dec 2017 12:19:07 +0100 Subject: [PATCH] fontconfig: make fonts accessible when in NixOS module --- modules/misc/fontconfig.nix | 38 +++++++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/modules/misc/fontconfig.nix b/modules/misc/fontconfig.nix index 9ad8b195..73f38ec4 100644 --- a/modules/misc/fontconfig.nix +++ b/modules/misc/fontconfig.nix @@ -28,14 +28,32 @@ in }; }; - config = mkIf cfg.enableProfileFonts { - xdg.configFile."fontconfig/conf.d/10-nix-profile-fonts.conf".text = '' - - - - ${config.home.profileDirectory}/lib/X11/fonts - ${config.home.profileDirectory}/share/fonts - - ''; - }; + config = mkMerge [ + (mkIf cfg.enableProfileFonts { + xdg.configFile."fontconfig/conf.d/10-nix-profile-fonts.conf".text = '' + + + + ${config.home.profileDirectory}/lib/X11/fonts + ${config.home.profileDirectory}/share/fonts + + ''; + }) + + # If we are inside a NixOS system configuration then packages are + # installed through the NixOS `users.users..packages` + # option. Unfortunately fontconfig does not know about the + # per-user installation directory so we have to add that directory + # in a extra configuration file. + (mkIf config.submoduleSupport.enable { + xdg.configFile."fontconfig/conf.d/10-nix-per-user-fonts.conf".text = '' + + + + /etc/profiles/per-user/${config.home.username}/lib/X11/fonts + /etc/profiles/per-user/${config.home.username}/share/fonts + + ''; + }) + ]; }