Obsidian does not find installed fonts

Hi guys, I have a small issue with the Obsidian package. Namely, I’ve installed multiple fonts on my system that work fine anywhere else (GTK, waybar, browser, kitty terminal, VSCodium, …), but Obsidian does not show any of the installed fonts in the font selection. I’ve looked through various wiki and forum posts regarding fonts, and this is the current setup I’m using for those fonts that cannot be set directly in the configuration:

{ pkgs, config, ... }:

{
    system.fsPackages = [ pkgs.bindfs ];
    fileSystems = let
        mkRoSymBind = path: {
        device = path;
        fsType = "fuse.bindfs";
        options = [ "ro" "resolve-symlinks" "x-gvfs-hide" ];
        };
        aggregatedIcons = pkgs.buildEnv {
        name = "system-icons";
        paths = with pkgs; [
            #libsForQt5.breeze-qt5  # for plasma
            gnome-themes-extra
        ];
        pathsToLink = [ "/share/icons" ];
        };
        aggregatedFonts = pkgs.buildEnv {
        name = "system-fonts";
        paths = config.fonts.packages;
        pathsToLink = [ "/share/fonts" ];
        };
    in {
        "/usr/share/icons" = mkRoSymBind "${aggregatedIcons}/share/icons";
        "/usr/local/share/fonts" = mkRoSymBind "${aggregatedFonts}/share/fonts";
    };

    fonts = {
        fontDir.enable = true;
        packages = with pkgs; [
        (nerdfonts.override { fonts = [ "JetBrainsMono" "Noto" ]; })
        sn-pro
        ];
    };

}

I’ve also asked on the Obsidian forum where the binary checks for installed fonts. They are currently installed in /usr/local/share/fonts as well as symlinks in ~/.local/share/fonts. I apologize in advance for any newbie mistakes I’ve made, and I’d appreciate any help I can get!

When you try to use a font in Obsidian, it doesn’t show you its name in the drop-down menu, but it can still load it:

You can get the font name by using fc-list:

$ fc-list | grep -i miracode
/home/user/.local/share/fonts/nixos/miracode/truetype/Miracode.ttf: Miracode:style=Regular
/nix/store/bg9n8468wlcr30y88wkksmd46rivn83a-miracode-1.0/share/fonts/truetype/Miracode.ttf: Miracode:style=Regular

Since you’ve set up /usr/local/share/fonts, I think this should just work. If not, you may need to symlink your fonts to ~/.local/share/fonts.

I’m currently doing this using home-manager (here), but you can also do the following as the Fonts - NixOS Wiki page suggests (needs fonts.fontDir.enable = true; to work):

mkdir $HOME/.local/share/fonts && ln -s /run/current-system/sw/share/X11/fonts ~/.local/share/fonts/

Just don’t forget to reload your font cache after that:

fc-cache -f -v

Thanks for your reply, I had to play around a bit more with all the variations I could think of in order to get it working. In the end, what worked for me was to set e.g. the monospace font to “JetBrainsMonoNL Nerd Font”, and the corresponding output from the command you provided actually displayed that. Thanks a lot!

1 Like