shell: prevent crashing of non-Guix apps on foreign distros
[~bandali/configs] / .profile
... / ...
CommitLineData
1# ~/.profile: executed by the command interpreter for login shells.
2# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
3# exists.
4
5# source host-specific profile
6if [ -f "$HOME/.config/profiles/$(hostname)" ]; then
7 . "$HOME/.config/profiles/$(hostname)"
8fi
9
10export EDITOR="emacsclient -nw"
11export VISUAL="emcl"
12
13PATH="$HOME/usr/local/bin:$HOME/.local/bin:$PATH"
14PATH="$HOME/.cabal/bin:$HOME/.cargo/bin:$HOME/.elan/bin:$PATH"
15if [ -z "$IS_GUIX_SYSTEM" ]; then
16 PATH="$HOME/.config/guix/current/bin${PATH:+:}$PATH"
17 INFOPATH="$HOME/.config/guix/current/share/info${INFOPATH:+:}$INFOPATH"
18 export GUIX_LOCPATH="$HOME/.guix-profile/lib/locale"
19fi
20export PATH
21export INFOPATH
22
23export MY_GUIX_MANIFESTS="$HOME/.config/guix/manifest"
24export MY_GUIX_PROFILES="$HOME/.config/guix/profile"
25
26export XDG_CONFIG_HOME="$HOME/.config"
27export XDG_DATA_HOME="$HOME/.local/share"
28
29if [ -f "$HOME/.config/user-dirs.dirs" ]; then
30 set -a
31 . "$HOME/.config/user-dirs.dirs"
32 set +a
33fi
34
35export INPUTRC="$XDG_CONFIG_HOME"/readline/inputrc
36export SCREENRC="$XDG_CONFIG_HOME"/screen/screenrc
37
38export MAILDIR="$HOME/mail"
39export CVS_RSH="ssh"
40
41export GOPATH="$HOME/src/go"
42
43# if running bash
44if [ -n "$BASH_VERSION" ]; then
45 # include .bashrc if it exists
46 if [ -f "$HOME/.bashrc" ]; then
47 . "$HOME/.bashrc"
48 fi
49fi
50
51if [ -z "$IS_GUIX_SYSTEM" ]; then
52 # if guix is installed
53 if [ -x "$(command -v guix)" ]; then
54 SSL_CERT_DIR="$HOME/.guix-profile/etc/ssl/certs"
55 if [ -d "$SSL_CERT_DIR" -o -h "$SSL_CERT_DIR" ]; then
56 export SSL_CERT_DIR
57 export SSL_CERT_FILE="$HOME/.guix-profile/etc/ssl/certs/ca-certificates.crt"
58 else
59 printf "it seems you forgot to \`guix install nss-certs\'\n"
60 fi
61 GUIX_PROFILE="$HOME/.guix-profile"
62 . "$GUIX_PROFILE/etc/profile"
63 unset XDG_DATA_DIRS
64 fi
65fi
66
67for p in $MY_GUIX_PROFILES/*; do
68 profile=$p/$(basename "$p")
69 if [ -f "$profile"/etc/profile ]; then
70 GUIX_PROFILE="$profile"
71 . "$GUIX_PROFILE"/etc/profile
72 fi
73 unset profile
74done
75
76# start an ssh-agent (with guix's openssh)
77if [ -z "$IS_GUIX_SYSTEM" ]; then
78 if ! pgrep -u "$USER" ssh-agent > /dev/null; then
79 ssh-agent > ~/.ssh-agent-thing
80 fi
81 if [[ ! "$SSH_AUTH_SOCK" ]]; then
82 eval "$(<~/.ssh-agent-thing)"
83 fi
84fi
85
86# footenote: when on a foreign distro and using Xfce, don't forget to
87# disable its auto-start of gpg- and ssh-agent, by issuing
88# xfconf-query -c xfce4-session -p /startup/ssh-agent/enabled -n -t bool -s false
89# xfconf-query -c xfce4-session -p /startup/gpg-agent/enabled -n -t bool -s false
90# see https://docs.xfce.org/xfce/xfce4-session/advanced#ssh_and_gpg_agents
91# also, MATE does something similar with gnome-keyring-daemon:
92# http://william.shallum.net/random-notes/disabling-gnome-keyring-daemon-ssh-agent-on-mate-desktop