Web lists-archives.com

Re: The same environment variables everywhere




tomas@xxxxxxxxxx [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

~/.xsession:

    . ~/.profile
    # 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
    ExecStart=/usr/bin/emacs --daemon
    SuccessExitStatus=15
    Restart=on-failure
    TimeoutStartSec=0
    TimeoutStopSec=0

    [Install]
    WantedBy=graphical-session.target

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

Attachment: signature.asc
Description: PGP signature