1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-27 05:29:46 +01:00

fontconfig: make fonts accessible when in NixOS module

This commit is contained in:
Robert Helgesson 2017-12-21 12:19:07 +01:00
parent 127e28c7d8
commit 4b7809efff
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89

View file

@ -28,7 +28,8 @@ in
}; };
}; };
config = mkIf cfg.enableProfileFonts { config = mkMerge [
(mkIf cfg.enableProfileFonts {
xdg.configFile."fontconfig/conf.d/10-nix-profile-fonts.conf".text = '' xdg.configFile."fontconfig/conf.d/10-nix-profile-fonts.conf".text = ''
<?xml version='1.0'?> <?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'> <!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
@ -37,5 +38,22 @@ in
<dir>${config.home.profileDirectory}/share/fonts</dir> <dir>${config.home.profileDirectory}/share/fonts</dir>
</fontconfig> </fontconfig>
''; '';
}; })
# If we are inside a NixOS system configuration then packages are
# installed through the NixOS `users.users.<name?>.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 = ''
<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>
<dir>/etc/profiles/per-user/${config.home.username}/lib/X11/fonts</dir>
<dir>/etc/profiles/per-user/${config.home.username}/share/fonts</dir>
</fontconfig>
'';
})
];
} }