Hi Folks,

I have a small Python script that sends me desktop notifications to help remind me to stop staring at the screen and go to bed on time. I'd like to turn it into a Guix home service, but I'm struggling and would love some
advice.

Source for package, service and example home config is here:
https://git.sr.ht/~sturm/bedtime/tree

I can run the script like this, which works fine:

$ guix shell libnotify python python-pygobject dbus -- python3 -u bedtime.py

I've added a package "bedtime" in bedtime.scm. That works fine too:

 $ guix shell -L . bedtime -- python3 -u bedtime.py

For what it's worth, both these commands fail if I add --pure. This seems like a
potential issue:

$ guix shell libnotify python python-pygobject dbus -- python3 -u bedtime.py
 Traceback (most recent call last):
 ...
File "/home/ben/repos/bedtime/bedtime.py", line 47, in notify_of_bedtime
     Notify.Notification.new("Starting bedtime reminder").show()
gi.repository.GLib.GError: g-dbus-error-quark: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.Notifications was not provided by any .service files (2)

I've tried to create an initial Guix home service "home-bedtime-service-type" in bedtime.scm. I can install this with `guix home` but it seems to fail, unable to
find the dependency python-pygobject (gi):

 $ guix home reconfigure -L . home-example.scm
 $ herd enable bedtime
 $ herd start bedtime
 $ tail -f ~/.local/state/shepherd/bedtime.log
 2025-06-08 16:15:56 Traceback (most recent call last):
2025-06-08 16:15:56 File "/gnu/store/39sw79zg00y94l8rpxxh1l3rn65gjydm-bedtime-0/bin/bedtime.py", line 10, in <module>
 2025-06-08 16:15:56     import gi
 2025-06-08 16:15:56 ModuleNotFoundError: No module named 'gi'

Regards,
Ben

Reply via email to