user/direnv: clear cache on activation

also changed the layout name to be a bit easier to find if need be
This commit is contained in:
LavaDesu 2021-11-28 20:36:42 +07:00
parent b333c10ac6
commit 3a5115c86a
Signed by: cilly
GPG key ID: 6500251E087653C9
2 changed files with 8 additions and 1 deletions

View file

@ -1,4 +1,4 @@
{ config, ...}: {
{ config, lib, ... }: {
programs.direnv = {
enable = true;
nix-direnv = {
@ -8,4 +8,9 @@
programs.git.extraConfig.core.excludesFile = ".envrc";
# We can't use .source since hm manages this file too
xdg.configFile."direnv/direnvrc".text = builtins.readFile ../../res/direnvrc;
home.activation = {
direnvClearCache = lib.hm.dag.entryAfter ["writeBoundary"] ''
$DRY_RUN_CMD rm -rf $VERBOSE_ARG $HOME/.cache/direnv/layouts
'';
};
}

View file

@ -4,5 +4,7 @@ direnv_layout_dir() {
echo "${direnv_layout_dirs[$PWD]:=$(
echo -n "$XDG_CACHE_HOME"/direnv/layouts/
echo -n "$PWD" | shasum | cut -d ' ' -f 1
echo -n "-"
basename $PWD
)}"
}