Web lists-archives.com

The same environment variables everywhere




I would like to hear some ideas on how to set various environment
variables (PATH, MANPATH, EDITOR etc.) in one place that would make them
effective everywhere. My "everywhere" means:

  - X session started through lightdm and ~/.xsession script
  - Linux console login (bash)
  - user's systemd services

Currently I define variables in ~/.profile and I import that file to
~/.xsession (with shell's source command: ". ~/.profile"). I also have
"systemd --user import-environment" command at the end of ~/.profile.

This works quite well but if there's a systemd user service that starts
automatically through ~/.config/systemd/user/default.target.wants/
symbolic link the service process doesn't get my variables. That's
probably because the service is started before my "systemd --user
import-environment" command.

Simple systemd user services don't need all the environment variables
but I'm also starting "emacs --daemon" as a systemd user service and for
that process I need my usual environment.

What would you do?

-- 
/// Teemu Likonen   - .-..   <https://keybase.io/tlikonen> //
// PGP: 4E10 55DC 84E9 DFF6 13D7 8557 719D 69D3 2453 9450 ///

Attachment: signature.asc
Description: PGP signature