aboutsummaryrefslogtreecommitdiff
path: root/user
diff options
context:
space:
mode:
Diffstat (limited to 'user')
-rw-r--r--user/direnv/direnv.toml4
-rw-r--r--user/direnv/direnvrc12
-rw-r--r--user/zsh/zshrc-workstation.sh2
3 files changed, 18 insertions, 0 deletions
diff --git a/user/direnv/direnv.toml b/user/direnv/direnv.toml
new file mode 100644
index 0000000..1573479
--- /dev/null
+++ b/user/direnv/direnv.toml
@@ -0,0 +1,4 @@
+[global]
+# direnv by default prints which environment variables are being exported
+# Since nix-direnv sets quite a lot I'm filtering this out.
+log_filter = "^(un)?loading"
diff --git a/user/direnv/direnvrc b/user/direnv/direnvrc
new file mode 100644
index 0000000..f64197b
--- /dev/null
+++ b/user/direnv/direnvrc
@@ -0,0 +1,12 @@
+# direnv by default puts its cache in .direnv/ next to the .envrc.
+# I rather have my caches in ~/.cache.
+: "${XDG_CACHE_HOME:="${HOME}/.cache"}"
+declare -A direnv_layout_dirs
+direnv_layout_dir() {
+ local hash path
+ echo "${direnv_layout_dirs[$PWD]:=$(
+ hash="$(sha1sum - <<< "$PWD" | head -c40)"
+ path="${PWD//[^a-zA-Z0-9]/-}"
+ echo "${XDG_CACHE_HOME}/direnv/layouts/${hash}${path}"
+ )}"
+}
diff --git a/user/zsh/zshrc-workstation.sh b/user/zsh/zshrc-workstation.sh
index 9a255a7..b7458b0 100644
--- a/user/zsh/zshrc-workstation.sh
+++ b/user/zsh/zshrc-workstation.sh
@@ -17,6 +17,8 @@ path+=$CARGO_HOME/bin
path+=$GOPATH/bin
path+=$NPM_CONFIG_PREFIX/bin
+eval "$(direnv hook zsh)"
+
function ssh() {
# In my ~/.ssh/config I configure host-specific background colors, for example:
#