aboutsummaryrefslogtreecommitdiff
path: root/user
diff options
context:
space:
mode:
authorMartin Fischer <martin@push-f.com>2025-10-31 07:10:25 +0100
committerMartin Fischer <martin@push-f.com>2025-11-17 07:41:47 +0100
commitae1ba47a679903e6a1b98a5b1e00f65e32b082a3 (patch)
treeaf310a989b68c4a6d7b92f70c5352a030ff370dc /user
parentad2889e6d62c64d133c1147f247f761b13d6d374 (diff)
feat(workstation): add (nix-)direnvHEADmaster
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:
#