Hi there,
I am a new nixos user (23.05), so at the moment I only deal with settings in configuration.nix, also without flakes or home manager. I’m using hyprland.
My problem is that I cannot see the svg icons in eww and nwg-bar. I have not installed that many programs yet, but it seems that svg icons are not displayed in general.
Which settings do I need to get them displayed? How can I fix this? What software/modules do I need?
I have already looked at many configuration.nix files without getting anywhere.
BR, Michael
Seems you’re not the only one: icons not shown · Issue #23 · nwg-piotr/nwg-bar · GitHub
Can you check what output you’re seeing when running eww
and nwg-bar
from the terminal?
So I’ve looked into it further (see also the comments on the linked issue), and it seems the main problem is that gdk-pixbuf
only supports a few basic bitmap formats and relies on librsvg
to render SVG files.
There seem to be two solutions to this:
1. NixOS configuration option
There seems to be a configuration option services.xserver.gdk-pixbuf.modulePackages
that the NixOS module gdk-pixbuf
reads. You could try setting that like below in your configuration.nix
:
services.xserver.gdk-pixbuf.modulePackages = [ pkgs.librsvg ];
This might work despite you using wayland.
2. setupHook in the package itself
There is a setupHook that specifically swaps in another pixbuf loader cache in the gdk-pixbuf
package that is called by the wrapGAppsHook if one is defined in the buildInputs. It’s made specifically to solve this kind of problem, as all GTK-based apps will struggle with this.
I think this might be the correct approach for a permanent solution to this problem, as it allows to enable the libsrvg
loader specifically for nwg-bar
. I attempted to fix that in this Draft PR. Maybe you could try it out?
To do so, make the following changes; instead of starting your configuration.nix
like this:
{ config, pkgs, ... }:
{
Start it like so:
{ config, pkgs, ...}:
let
pkgs-ifreilicht = import (fetchGit {
url = "https://github.com/iFreilicht/nixpkgs";
ref = "nwg-bar-fix-svg-icons";
rev = "7547f3c0ab0b072b2ab6e3e30d1ae837883c0a18";
}) {};
in
{
And later, wherever you used pkgs.nwg-bar
to install nwg-bar, use pkgs-ifreilicht.nwg-bar
instead.
2 Likes
It works! Thank you very much! nwg-bar is showing icons.
Wasn’t necessary to try the second option.
Now viewnior’s also showing svg pictures.
Awesome! Would you mind trying out the second option anyway? Of course disabling the first option first so you can be sure the second one worked 
If you can confirm that the second one works, I can get this PR merged into nixpkgs so the package works out-of-the-box and other users in the future won’t have this issue.
You were also talking about eww, is that fixed now as well?
Uninstalled nwg-bar, pasted your lines, commented the line from option 1 and configured ifreilicht-bar. Also installed git.
nixos-rebuild switch stopped at the start:
building nix..
building the system configuration..
Anything else I need to consider?
1 Like
About eww. Must have been a different problem because others were shown. Switched to another eww config anyway.
You just have to wait, it will take a while to download 
Took ages.
Yes, option 2 worked.
1 Like