Support env vars for {DESK,LAP,CLOUD}TOP devices
I recently changed my hostname for my desktop and laptop from wpcarro.lon.corp.google.com -> zeno.lon.corp.google.com wpcarro2 -> seneca If you're curious, the names Zeno and Seneca come from famous Stoic philosophers. As you can see from this commit, my configuration depends on the values of these hostnames. Immediately impacted: - .profile - device.el Not immediately impacted: - configs/install - configs/uninstall - .ssh/config - .zshrc* * As a side note, I should stop supporting ZSH. Using an .envrc file helps me DRY up some of my configuration. Ideally I should only need to make changes to the .envrc file and then expect everything to work as expected. Let's see how that goes.
This commit is contained in:
parent
d28690d814
commit
093b566e71
7 changed files with 21 additions and 38 deletions
3
.envrc
3
.envrc
|
@ -1,2 +1,5 @@
|
||||||
export DOTFILES=~/dotfiles
|
export DOTFILES=~/dotfiles
|
||||||
|
export DESKTOP=zeno.lon.corp.google.com
|
||||||
|
export LAPTOP=seneca
|
||||||
|
export CLOUDTOP=wpcarro.c.googlers.com
|
||||||
NIX_PATH=nixpkgs=$HOME/.nix-defexpr/nixpkgs:depot=$HOME/depot:universe=$HOME/universe
|
NIX_PATH=nixpkgs=$HOME/.nix-defexpr/nixpkgs:depot=$HOME/depot:universe=$HOME/universe
|
||||||
|
|
|
@ -3,14 +3,11 @@
|
||||||
configs="$DOTFILES/configs"
|
configs="$DOTFILES/configs"
|
||||||
|
|
||||||
case $(hostname) in
|
case $(hostname) in
|
||||||
# desktop
|
$DESKTOP)
|
||||||
wpcarro.lon.corp.google.com)
|
|
||||||
(cd "$configs/desktop" && stow --target="$HOME" .);;
|
(cd "$configs/desktop" && stow --target="$HOME" .);;
|
||||||
# laptop
|
$LAPTOP)
|
||||||
wpcarro2)
|
|
||||||
(cd "$configs/work_laptop" && stow --target="$HOME" .);;
|
(cd "$configs/work_laptop" && stow --target="$HOME" .);;
|
||||||
# cloudtop
|
$CLOUDTOP)
|
||||||
wpcarro.c.googlers.com)
|
|
||||||
(cd "$configs/cloudtop" && stow --target="$HOME" .);;
|
(cd "$configs/cloudtop" && stow --target="$HOME" .);;
|
||||||
# Acer Manjaro laptop
|
# Acer Manjaro laptop
|
||||||
acer-manjaro)
|
acer-manjaro)
|
||||||
|
|
|
@ -14,8 +14,8 @@
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
(defconst device/hostname->device
|
(defconst device/hostname->device
|
||||||
'(("wpcarro2" . work-laptop)
|
'(("zeno.lon.corp.google.com" . work-desktop)
|
||||||
("wpcarro.lon.corp.google.com" . work-desktop))
|
("seneca" . work-laptop))
|
||||||
"Mapping hostname to a device symbol.")
|
"Mapping hostname to a device symbol.")
|
||||||
|
|
||||||
;; TODO: Should I generate these predicates?
|
;; TODO: Should I generate these predicates?
|
||||||
|
|
|
@ -51,16 +51,10 @@ export XSECURELOCK_NO_COMPOSITE=1
|
||||||
LOCALE_ARCHIVE=$(readlink ~/.nix-profile/lib/locale)/locale-archive
|
LOCALE_ARCHIVE=$(readlink ~/.nix-profile/lib/locale)/locale-archive
|
||||||
export LOCALE_ARCHIVE
|
export LOCALE_ARCHIVE
|
||||||
|
|
||||||
# Set environment variables for Nix
|
# Set environment variables for Nix. Don't run this for systems running NixOS.
|
||||||
# Don't run this for systems running NixOS
|
# TODO: Learn why I can't use the variables from ~/dotfiles/.envrc.
|
||||||
case $(hostname) in
|
case $(hostname) in
|
||||||
# desktop
|
zeno.lon.corp.google.com) . ~/.nix-profile/etc/profile.d/nix.sh;;
|
||||||
wpcarro.lon.corp.google.com)
|
seneca) . ~/.nix-profile/etc/profile.d/nix.sh;;
|
||||||
. ~/.nix-profile/etc/profile.d/nix.sh;;
|
wpcarro.c.googlers.com) . ~/.nix-profile/etc/profile.d/nix.sh;;
|
||||||
# cloudtop
|
|
||||||
wpcarro.c.googlers.com)
|
|
||||||
. ~/.nix-profile/etc/profile.d/nix.sh;;
|
|
||||||
# work_laptop
|
|
||||||
wpcarro2)
|
|
||||||
. ~/.nix-profile/etc/profile.d/nix.sh;;
|
|
||||||
esac
|
esac
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Google work station
|
# Google work station
|
||||||
Host desktop
|
Host desktop
|
||||||
Hostname wpcarro.lon.corp.google.com
|
Hostname zeno.lon.corp.google.com
|
||||||
|
|
||||||
# Google cloud instance
|
# Google cloud instance
|
||||||
Host cloudtop
|
Host cloudtop
|
||||||
|
|
|
@ -34,18 +34,10 @@ antigen bundle zsh-users/zsh-syntax-highlighting
|
||||||
|
|
||||||
# Theming
|
# Theming
|
||||||
case $(hostname) in
|
case $(hostname) in
|
||||||
# desktop
|
$DESKTOP) antigen theme frisk;;
|
||||||
wpcarro.lon.corp.google.com)
|
$LAPTOP) antigen theme refined;;
|
||||||
antigen theme frisk;;
|
$CLOUDTOP) antigen theme cloud;;
|
||||||
# cloudtop
|
acer-manjaro) antigen theme frisk;;
|
||||||
wpcarro.c.googlers.com)
|
|
||||||
antigen theme cloud;;
|
|
||||||
# laptop
|
|
||||||
wpcarro2)
|
|
||||||
antigen theme refined;;
|
|
||||||
# acer NixOS laptop
|
|
||||||
acer-manjaro)
|
|
||||||
antigen theme frisk;;
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Leave this last
|
# Leave this last
|
||||||
|
|
|
@ -3,14 +3,11 @@
|
||||||
configs="$DOTFILES/configs"
|
configs="$DOTFILES/configs"
|
||||||
|
|
||||||
case $(hostname) in
|
case $(hostname) in
|
||||||
# desktop
|
$DESKTOP)
|
||||||
wpcarro.lon.corp.google.com)
|
|
||||||
(cd "$configs/desktop" && stow --delete --target="$HOME" .);;
|
(cd "$configs/desktop" && stow --delete --target="$HOME" .);;
|
||||||
# laptop
|
$LAPTOP)
|
||||||
wpcarro2)
|
|
||||||
(cd "$configs/laptop" && stow --delete --target="$HOME" .);;
|
(cd "$configs/laptop" && stow --delete --target="$HOME" .);;
|
||||||
# cloudtop
|
$CLOUDTOP)
|
||||||
wpcarro.c.googlers.com)
|
|
||||||
(cd "$configs/cloudtop" && stow --delete --target="$HOME" .);;
|
(cd "$configs/cloudtop" && stow --delete --target="$HOME" .);;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue