Add direnv cache
Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
@@ -4,14 +4,30 @@
|
|||||||
}:
|
}:
|
||||||
{ inputs, ... }:
|
{ inputs, ... }:
|
||||||
{
|
{
|
||||||
home-manager.users.${user} = {
|
home-manager.users.${user}.programs = {
|
||||||
programs.direnv = {
|
direnv = {
|
||||||
enable = true;
|
enable = true;
|
||||||
silent = true;
|
silent = true;
|
||||||
nix-direnv.enable = true;
|
nix-direnv.enable = true;
|
||||||
enableZshIntegration = true;
|
enableZshIntegration = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# https://github.com/direnv/direnv/wiki/Customizing-cache-location
|
||||||
|
zsh.initExtra = ''
|
||||||
|
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 "${home}/.cache/direnv/layouts/''${hash}''${path}"
|
||||||
|
)}"
|
||||||
|
}
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
environment.persistence."/persist"."${home}/.config/direnv/direnv.toml" = { };
|
environment.persistence = {
|
||||||
|
"/persist"."${home}/.config/direnv/direnv.toml" = { };
|
||||||
|
"/cache"."${home}/.cache/direnv" = { };
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user