Re: The same environment variables everywhere
On Mon 27 Feb 2017 at 15:19:27 (+0200), Teemu Likonen wrote:
> tomas@tuxteam.de [2017-02-27 09:12:28+01] wrote:
>
> > On Mon, Feb 27, 2017 at 09:07:19AM +0100, deloptes wrote:
> >> So I do distinguish between settings for X session and for not X
> >> session - at least two places for the variables. Further more there
> >> are global and user specific ... etc
> >
> > Yes, all of those! But I don't see how that's an answer to the OP's
> > legitimate question: how to keep things that belong together in one
> > place, instead of repeating it in every bit of config?
>
> Yes. I know ~/.profile, ~/.xsession, systemd units' "Environment=...",
> "systemctl --user import-enviroment" and various other things. I can
> manage. I'm just asking for other ideas on how to handle things
> mentioned in my original post.
>
> Well, here's the idea of my current setup (not exact copy):
>
> ~/.profile:
>
> # Set the usual environment:
> export PATH=...
> export EDITOR=...
> systemctl --user import-enviroment
Is that typo actually in the file?
> ~/.xsession:
>
> . ~/.profile
My profile has side effects. Calling it from ~/.xsession
would repeat them, which would be undesirable.
I would be loath to just chuck everything in one place.
Unpicking an undesirable effect could be very tedious.
> # Start various systemd services:
> systemctl --user start graphical-session.target
> /usr/bin/i3
> systemctl --user stop graphical-session.target
>
> ~/.config/systemd/user/emacs.service:
>
> [Unit]
> Description=The Emacs Operating System
>
> [Service]
> Type=forking
Have you tried putting an EnvironmentFile= in here
(man 5 systemd.service)? You could source the file from
elsewhere if required so that you only need one set of
definitions.
> ExecStart=/usr/bin/emacs --daemon
> SuccessExitStatus=15
> Restart=on-failure
> TimeoutStartSec=0
> TimeoutStopSec=0
>
> [Install]
> WantedBy=graphical-session.target
Cheers,
David.
Reply to: