Home Manager + Waybar :: Unable to receive desktop appearance

Via Home Manager, I am doing the following (I have tried multiple configs, without any luck):

programs.waybar.enable = true;
programs.waybar.style = (builtins.readFile ../sources/waybar.css);
programs.waybar.settings = [
    {
        mainBar = {
            layer = "top";
            position = "top";
            height = 30;
            modules-left = [ ];
            modules-center = [ ];
            modules-right = [ ];
        };
    }
];

Trying to start waybar, results in:

[2024-03-20 21:28:54.652] [info] Using configuration file /home/poq/.config/waybar/config
[2024-03-20 21:28:54.654] [info] Unable to receive desktop appearance: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.portal.Desktop was not provided by any .service files
[2024-03-20 21:28:54.654] [info] Using CSS file /home/poq/.config/waybar/style.css
[2024-03-20 21:28:54.661] [info] Bar configured (width: 1280, height: 1) for output: eDP-1
[2024-03-20 21:28:59.920] [info] Quitting.

Any inputs on what to do here?

After debugging, I figured out that waybar works if I enable it like this:

    home.packages = with pkgs; [
        waybar
    ];

So, by some reason programs.waybar.enable = true; does not give the same result. Seems strange to me.

On fresh nixOS installation that is using unstable channel, with programs.waybar.enable = true;

meson.build:95:17: ERROR: Dependency "wireplumber-0.4" not found, tried pkgconfig
and 2 more errors, something about dependency of derivation home-manager-path.drv and home-manager-generation.drv failing to build.
1 Like

OK, so there is something wrong with the Waybar version one get through Home Manager. Sounds like a source of confusion and trouble that you install different builds of the same programs using programs.[programName].enable vs. specifying the package name.

According to some search results (here, here and here), it also seems like the above error can be caused by missing dependencies. To no avail I did install xdg-desktop-portal, xdg-desktop-portal-hyprland, xdg-desktop-portal-wlr and xdg-desktop-portal-gtk as well.

1 Like

What’s interesting for me is that, it complains about wireplumber-0.4 while for unstable channel there is version 0.5.
Look here: Home-manager: unable to build waybar.

1 Like

Well, that is exactly the problem. Waybar expects 0.4 to be present, which is no longer present since the bump to 0.5. waybar: build against wireplumber-0.4 by andresilva · Pull Request #297158 · NixOS/nixpkgs · GitHub

I’m on 23.11, not unstable. Installing wireplumber makes no difference, logically enough (?) as the error message is:
Unable to receive desktop appearance: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.portal.Desktop was not provided by any .service files.

Maybe it is related to some missing dependencies, but I do not know which ones.

My bad! The output Unable to receive desktop appearance: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.portal.Desktop was not provided by any .service files was not an error that was thrown due to waybar not starting. By updating the programs.waybar.settings (to something less minimalistic that what I tried at first), the waybar showed up correctly.

I misunderstood your problem. With your settings on 23.11 I also had bar height of 1, but it was not quitting. How could you not try waybar with default settings at the begging is mind bending.