about summary refs log tree commit diff
diff options
context:
space:
mode:
authorWilliam Carroll <wpcarro@gmail.com>2020-01-29T12·38+0000
committerWilliam Carroll <wpcarro@gmail.com>2020-01-29T14·21+0000
commit093b566e711c9484d4dd8c32e076a525895998ad (patch)
treeae0fbf91f104b7fc94fa91afa6edddd4fc232d9d
parentd28690d8146cd6dd5377f1c1df5724caf6f89315 (diff)
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.
-rw-r--r--.envrc3
-rwxr-xr-xconfigs/install9
-rw-r--r--configs/shared/.emacs.d/wpc/device.el4
-rw-r--r--configs/shared/.profile16
-rw-r--r--configs/shared/.ssh/config2
-rw-r--r--configs/shared/.zshrc16
-rwxr-xr-xconfigs/uninstall9
7 files changed, 21 insertions, 38 deletions
diff --git a/.envrc b/.envrc
index f097cc4eb456..bf9f120d9158 100644
--- a/.envrc
+++ b/.envrc
@@ -1,2 +1,5 @@
 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
diff --git a/configs/install b/configs/install
index e33e32c1affe..4aedf35be1f7 100755
--- a/configs/install
+++ b/configs/install
@@ -3,14 +3,11 @@
 configs="$DOTFILES/configs"
 
 case $(hostname) in
-  # desktop
-  wpcarro.lon.corp.google.com)
+  $DESKTOP)
     (cd "$configs/desktop" && stow --target="$HOME" .);;
-  # laptop
-  wpcarro2)
+  $LAPTOP)
     (cd "$configs/work_laptop" && stow --target="$HOME" .);;
-  # cloudtop
-  wpcarro.c.googlers.com)
+  $CLOUDTOP)
     (cd "$configs/cloudtop" && stow --target="$HOME" .);;
   # Acer Manjaro laptop
   acer-manjaro)
diff --git a/configs/shared/.emacs.d/wpc/device.el b/configs/shared/.emacs.d/wpc/device.el
index 4d79214c378a..03eb55beb7f4 100644
--- a/configs/shared/.emacs.d/wpc/device.el
+++ b/configs/shared/.emacs.d/wpc/device.el
@@ -14,8 +14,8 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 (defconst device/hostname->device
-  '(("wpcarro2" . work-laptop)
-    ("wpcarro.lon.corp.google.com" . work-desktop))
+  '(("zeno.lon.corp.google.com" . work-desktop)
+    ("seneca" . work-laptop))
   "Mapping hostname to a device symbol.")
 
 ;; TODO: Should I generate these predicates?
diff --git a/configs/shared/.profile b/configs/shared/.profile
index c53a0164d438..6513c2c9b5c0 100644
--- a/configs/shared/.profile
+++ b/configs/shared/.profile
@@ -51,16 +51,10 @@ export XSECURELOCK_NO_COMPOSITE=1
 LOCALE_ARCHIVE=$(readlink ~/.nix-profile/lib/locale)/locale-archive
 export LOCALE_ARCHIVE
 
-# Set environment variables for Nix
-# Don't run this for systems running NixOS
+# Set environment variables for Nix. Don't run this for systems running NixOS.
+# TODO: Learn why I can't use the variables from ~/dotfiles/.envrc.
 case $(hostname) in
-  # desktop
-  wpcarro.lon.corp.google.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;;
+  zeno.lon.corp.google.com) . ~/.nix-profile/etc/profile.d/nix.sh;;
+  seneca) . ~/.nix-profile/etc/profile.d/nix.sh;;
+  wpcarro.c.googlers.com) . ~/.nix-profile/etc/profile.d/nix.sh;;
 esac
diff --git a/configs/shared/.ssh/config b/configs/shared/.ssh/config
index 2283a7b0cc60..7519c00c0f65 100644
--- a/configs/shared/.ssh/config
+++ b/configs/shared/.ssh/config
@@ -1,6 +1,6 @@
 # Google work station
 Host desktop
-  Hostname wpcarro.lon.corp.google.com
+  Hostname zeno.lon.corp.google.com
 
 # Google cloud instance
 Host cloudtop
diff --git a/configs/shared/.zshrc b/configs/shared/.zshrc
index 7f846ce54de4..a8ea2657d723 100644
--- a/configs/shared/.zshrc
+++ b/configs/shared/.zshrc
@@ -34,18 +34,10 @@ antigen bundle zsh-users/zsh-syntax-highlighting
 
 # Theming
 case $(hostname) in
-  # desktop
-  wpcarro.lon.corp.google.com)
-    antigen theme frisk;;
-  # cloudtop
-  wpcarro.c.googlers.com)
-    antigen theme cloud;;
-  # laptop
-  wpcarro2)
-    antigen theme refined;;
-  # acer NixOS laptop
-  acer-manjaro)
-    antigen theme frisk;;
+  $DESKTOP)     antigen theme frisk;;
+  $LAPTOP)      antigen theme refined;;
+  $CLOUDTOP)    antigen theme cloud;;
+  acer-manjaro) antigen theme frisk;;
 esac
 
 # Leave this last
diff --git a/configs/uninstall b/configs/uninstall
index 77d3199f69f7..526c32113f53 100755
--- a/configs/uninstall
+++ b/configs/uninstall
@@ -3,14 +3,11 @@
 configs="$DOTFILES/configs"
 
 case $(hostname) in
-  # desktop
-  wpcarro.lon.corp.google.com)
+  $DESKTOP)
     (cd "$configs/desktop" && stow --delete --target="$HOME" .);;
-  # laptop
-  wpcarro2)
+  $LAPTOP)
     (cd "$configs/laptop" && stow --delete --target="$HOME" .);;
-  # cloudtop
-  wpcarro.c.googlers.com)
+  $CLOUDTOP)
     (cd "$configs/cloudtop" && stow --delete --target="$HOME" .);;
 esac