So when using the user-session@.service from the user-session-units what's the best / cleanest way to set global environment variables for that systemd --user instance (and thus, all programs spawned from it)?
What I'm talking about is /etc/profile and $HOME/.profile.
For example, I usally configure my XDG_CONFIG_HOME and XDG_CACHE_HOME in my ~/.profile. But since systemd --user is being started by systemd --session none of these environment variables are loaded.
The solution I've come up is to change the ExecStart in the user-session@.service file to something like this:
ExecStart=/usr/bin/sh -c "source /etc/profile; source $HOME/.config/bash/environment; exec /usr/lib/systemd/systemd --user"
I know I could use the `EnvironmentFile` option to load the environment variables from a file, but it's not as flexable as a bash script.
Am I thinking about this problem wrong? Is there a more "systemd --user"-y way of solving the problem?
Last edited by EvanPurkhiser (2013-08-12 03:02:48)