Help! xfce4-notifyd seems to be a ghost package

I’ll preface by saying I’m brand new to nixos so there’s a chance I may have missed something obvious, but after all my research I think not.
Since switching from KDE to XFCE out of personal preference, I began to notice random 30 second hangs in various programs and eventually traced this issue down to a lack of notification management, and the hanging happened when those programs would typically send notifications.
I installed xfce4-notifyd at the system level…

environment.systemPackages = with pkgs; [

…and rebuilt and rebooted the system. When the issue persisted I used systemctl status to check to see if it was running, and it returned

[jack@nicvape:~]$ sudo systemctl status xfce4-notifyd
Unit xfce4-notifyd.service could not be found.

I’ve visited a few github topics

and there were some solutions posted, I tried all of them to no avail. I would be more than happy to post my configuration.nix or any other config files contents or command outputs that may help track down the source of the issue.
Thank you in advance for the help!

Systemd packages should be added to systemd.packages NixOS option. But Xfce module already does that:

Looking inside the package, it is an user service so you need to use systemctl status --user xfce4-notifyd.

Good catch! Output is as follows

[jack@nicvape:~]$ systemctl status --user xfce4-notifyd
× xfce4-notifyd.service - XFCE notifications service
     Loaded: loaded (/etc/systemd/user/xfce4-notifyd.service; linked-runtime; vendor preset: enabled)
     Active: failed (Result: exit-code) since Sat 2022-09-24 14:28:02 EDT; 35min ago
    Process: 5737 ExecStart=/nix/store/l2s7j13imcg1595q0h3z7kikv3hp9v5j-xfce4-notifyd-0.6.3/lib/xfce4/notifyd/xfce4-notifyd (code=exited, status=1/FAILURE)
   Main PID: 5737 (code=exited, status=1/FAILURE)
        CPU: 20ms

Sep 24 14:28:02 nicvape systemd[1133]: Starting XFCE notifications service...
Sep 24 14:28:02 nicvape xfce4-notifyd[5737]: cannot open display: 
Sep 24 14:28:02 nicvape systemd[1133]: xfce4-notifyd.service: Main process exited, code=exited, status=1/FAILURE
Sep 24 14:28:02 nicvape systemd[1133]: xfce4-notifyd.service: Failed with result 'exit-code'.
Sep 24 14:28:02 nicvape systemd[1133]: Failed to start XFCE notifications service.

This is certainly a lot more useful. Not being able to open the display is probably a timing issue, so now I have to figure out whats trying to start notifyd before i open xfce. Is there anything in my configuration.nix that could give a more experienced user like yourself a clue?

Given that xfce4-notifyd is dbus-activated it cannot have been started before i initialized X with startx. However anyone who uses XFCE knows that when it starts it immediately notifies you of the network you joined, which takes place as soon as it starts. My xinitrc only contained the line exec xfce4-session so there was no instance in which the user services like notifyd could ever grab the environment variable for DISPLAY.
The solution then was to modify my .xinitrc file to read like this:

systemctl --user import-environment DISPLAY
exec xfce4-session

which gave notifyd (and all other user services) the opportunity to learn the display variable, and begin operation normally.
Thank you to user max (yeah, just max) for providing me the solution privately (and recommending nixos to me in the first place, its lovely)!

1 Like