Pass environment variables from shell to systemd
Instead of having the systemd user units in .config/systemd/user/ who's programs require access to a environment variable to define them explicitly using "Environment = 'VAR=value'". Instead from .bashrc and .zshrc we can import all environment variables using "systemctl --user import-environment" or import variables individually like so "systemctl --user import-environment VAR_NAME". Here I import (using the method above) both $PATH and $SMLNJ_HOME so that they can be used by emacs (and maybe some other program/systemd-user-unit I have forgotten). Signed-off-by: Collin J. Doering <rekahsoft@gmail.com>
This commit is contained in:
parent
d1b7db0a70
commit
cff91a9110
7
.bashrc
7
.bashrc
|
@ -48,7 +48,12 @@ stty stop undef
|
||||||
# * mathematica / tools
|
# * mathematica / tools
|
||||||
# * nxclient / associated tools
|
# * nxclient / associated tools
|
||||||
# * maven tools
|
# * maven tools
|
||||||
export PATH=export PATH=$HOME/.cabal/bin:$HOME/.gem/ruby/2.0.0/bin:$HOME/.bin:$HOME/.texlive/2013/bin/x86_64-linux:${PATH}:/opt/maven/bin:/opt/NX/bin
|
export PATH=export PATH=$HOME/.cabal/bin:$HOME/.gem/ruby/2.0.0/bin:$HOME/.bin:$HOME/.texlive/2014/bin/x86_64-linux:${PATH}:/opt/maven/bin:/opt/NX/bin:/usr/lib/smlnj/bin
|
||||||
|
ctlu import-environment PATH
|
||||||
|
|
||||||
|
# Setup smlnj (AUR)
|
||||||
|
export SMLNJ_HOME="/usr/lib/smlnj"
|
||||||
|
ctlu import-environment SMLNJ_HOME
|
||||||
|
|
||||||
# Setup gpg-agent
|
# Setup gpg-agent
|
||||||
if [ -f "${HOME}/.gpg-agent-info" ]; then
|
if [ -f "${HOME}/.gpg-agent-info" ]; then
|
||||||
|
|
|
@ -5,7 +5,6 @@ Description = Emacs: the extensible, self-documenting text editor
|
||||||
Type = forking
|
Type = forking
|
||||||
ExecStart = /usr/bin/emacs --daemon
|
ExecStart = /usr/bin/emacs --daemon
|
||||||
ExecStop = /usr/bin/emacsclient --eval "(progn (setq kill-emacs-hook 'nil) (kill-emacs))"
|
ExecStop = /usr/bin/emacsclient --eval "(progn (setq kill-emacs-hook 'nil) (kill-emacs))"
|
||||||
Environment = "PATH=/home/collin/.cabal/bin:/home/collin/.gem/ruby/2.0.0/bin:/home/collin/.bin:/home/collin/.texlive/2013/bin/x86_64-linux:/usr/local/sbin:/usr/local/bin:/usr/bin:/opt/android-sdk/platform-tools:/opt/android-sdk/tools:/usr/bin/vendor_perl:/usr/bin/core_perl:/usr/lib/smlnj/bin:/opt/maven/bin:/opt/NX/bin"
|
|
||||||
Restart = always
|
Restart = always
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
|
|
|
@ -4,7 +4,6 @@ Description = Remove idle cursor image from screen
|
||||||
[Service]
|
[Service]
|
||||||
type = simple
|
type = simple
|
||||||
ExecStart = /usr/bin/unclutter
|
ExecStart = /usr/bin/unclutter
|
||||||
Environment = "DISPLAY=:0"
|
|
||||||
Restart = always
|
Restart = always
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
|
|
|
@ -3,7 +3,6 @@ Description = A grabbing keys program for X
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
ExecStart = /usr/bin/xbindkeys -n -f %h/.xbindkeysrc
|
ExecStart = /usr/bin/xbindkeys -n -f %h/.xbindkeysrc
|
||||||
Environment = "DISPLAY=:0"
|
|
||||||
Restart = always
|
Restart = always
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
|
|
|
@ -3,7 +3,6 @@ Description = Extensible screen saver framework, plus locking
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
ExecStart = /usr/bin/xscreensaver -no-splash
|
ExecStart = /usr/bin/xscreensaver -no-splash
|
||||||
Environment = "DISPLAY=:0"
|
|
||||||
Restart = always
|
Restart = always
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
|
|
7
.zshrc
7
.zshrc
|
@ -81,7 +81,12 @@ stty stop undef
|
||||||
# * mathematica / tools
|
# * mathematica / tools
|
||||||
# * nxclient / associated tools
|
# * nxclient / associated tools
|
||||||
# * maven tools
|
# * maven tools
|
||||||
export PATH=$HOME/.cabal/bin:$HOME/.gem/ruby/2.0.0/bin:$HOME/.bin:$HOME/.texlive/2013/bin/x86_64-linux:${PATH}:/opt/maven/bin:/opt/NX/bin
|
export PATH=$HOME/.cabal/bin:$HOME/.gem/ruby/2.0.0/bin:$HOME/.bin:$HOME/.texlive/2014/bin/x86_64-linux:${PATH}:/opt/maven/bin:/opt/NX/bin:/usr/lib/smlnj/bin
|
||||||
|
ctlu import-environment PATH
|
||||||
|
|
||||||
|
# Setup smlnj (AUR)
|
||||||
|
export SMLNJ_HOME="/usr/lib/smlnj"
|
||||||
|
ctlu import-environment SMLNJ_HOME
|
||||||
|
|
||||||
# Setup gpg-agent
|
# Setup gpg-agent
|
||||||
if [ -f "${HOME}/.gpg-agent-info" ]; then
|
if [ -f "${HOME}/.gpg-agent-info" ]; then
|
||||||
|
|
Reference in New Issue