What is the recommended way to set up environment variables for a shepherd service? Is there a profile associated to the environment of a shepherd service where I could/should install required packages and have the correct environment variables set up automatically? Specifically, I have a service which uses gobject-introspection (from Python / python-pygobject), and had some difficulty to get it to run recently.
context (a bit long unfortunately): I have a shepherd-service which runs a Python script. The Python script listens on dbus to check if my external backup hard disk is mounted, and starts rsnapshot. This worked reliably for many years, until a recent guix pull / system reconfigure (moving from guix commit 461d773adead955e2daead70cee4415f7f0f00be -- january 2025 -- to d8aa9af09f901d1745470caa45ffe2178a9afce1 -- april 2025 --so a rather large range of commits unfortunately). Suddenly, the Python import statement import gi.repository.GLib would fail with exception 'ImportError: cannot import name GLib, introspection typelib not found'. This seemed to be due to a missing GI_TYPELIB_PATH enviroment variable, which I was able to fix manually by setting it in a wrap-executable phase (wrap-program (string-append out "/bin/listen_dbus.py") `("PATH" ":" prefix (,(string-append rsnapshot "/bin"))) `("GI_TYPELIB_PATH" ":" prefix (,(string-append glib "/lib/girepository-1.0")))) I'm wondering if this is the proper way to do this kind of thing? When installing gobject-instrospection etc in a profile, I know these environment variables are set automatically. I'm also wondering which change caused it to stop working without setting GI_TYPELIB_PATH after January... but that might be difficult to track down (I see an update of python-pygobject happened in that timeframe). Thanks for reading this far! Thomas