1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-26 21:19:45 +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,14 +28,32 @@ in
};
};
config = mkIf cfg.enableProfileFonts {
xdg.configFile."fontconfig/conf.d/10-nix-profile-fonts.conf".text = ''
<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>
<dir>${config.home.profileDirectory}/lib/X11/fonts</dir>
<dir>${config.home.profileDirectory}/share/fonts</dir>
</fontconfig>
'';
};
config = mkMerge [
(mkIf cfg.enableProfileFonts {
xdg.configFile."fontconfig/conf.d/10-nix-profile-fonts.conf".text = ''
<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>
<dir>${config.home.profileDirectory}/lib/X11/fonts</dir>
<dir>${config.home.profileDirectory}/share/fonts</dir>
</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>
'';
})
];
}