diff options
author | Alan Pearce | 2023-04-12 17:41:04 +0200 |
---|---|---|
committer | Alan Pearce | 2023-04-12 17:46:34 +0200 |
commit | 66b709c399053cc91bc767317b8ae835f7666b71 (patch) | |
tree | 2ea28cf3e3ab74578601308ea582192da72806e7 /user/settings | |
parent | 32a6944ea78623253aeedf9fc336c317f5e91eb7 (diff) | |
download | nixfiles-66b709c399053cc91bc767317b8ae835f7666b71.tar.lz nixfiles-66b709c399053cc91bc767317b8ae835f7666b71.tar.zst nixfiles-66b709c399053cc91bc767317b8ae835f7666b71.zip |
dev/base: store direnv cache in $XDG_CACHE_HOME
Diffstat (limited to 'user/settings')
-rw-r--r-- | user/settings/development/base.nix | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/user/settings/development/base.nix b/user/settings/development/base.nix index 9de20fc4..6eff88cf 100644 --- a/user/settings/development/base.nix +++ b/user/settings/development/base.nix @@ -47,4 +47,14 @@ in programs.zsh.initExtra = '' source ${direnvHook} ''; + xdg.configFile."direnv/direnvrc".text = '' + declare -A direnv_layout_dirs + direnv_layout_dir() { + echo "''${direnv_layout_dirs[$PWD]:=$( + local hash="$(${pkgs.coreutils}/bin/sha256sum - <<<"$\{PWD}" | cut -c-7)" + local path="''${PWD//[^a-zA-Z0-9]/-}" + echo "${config.xdg.cacheHome}/direnv/layouts/''${hash}''${path}" + )}" + } + ''; } |