nix-config/homeManagerModules/programs/direnv.nix

36 lines
765 B
Nix

{
lib,
config,
...
}:
let
cfg = config.krop.hm.programs.direnv;
in
{
options.krop.hm.programs.direnv = {
enable = lib.mkOption {
type = lib.types.bool;
default = true;
example = false;
description = "Enable my direnv configuration";
};
};
config = lib.mkIf cfg.enable {
programs.direnv = {
enable = true;
enableZshIntegration = true;
nix-direnv.enable = true;
stdlib = ''
: ''${XDG_CACHE_HOME:=$HOME/.cache}
declare -A direnv_layout_dirs
direnv_layout_dir() {
echo "''${direnv_layout_dirs[$PWD]:=$(
echo -n "$XDG_CACHE_HOME"/direnv/layouts/
echo -n "$PWD" | sha1sum | cut -d ' ' -f 1
)}"
}
'';
};
};
}