Reorganize imports
Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
33
hosts/common/configs/user/console/nix-direnv/default.nix
Normal file
33
hosts/common/configs/user/console/nix-direnv/default.nix
Normal file
@@ -0,0 +1,33 @@
|
||||
{
|
||||
user ? throw "user argument is required",
|
||||
home ? throw "home argument is required",
|
||||
}:
|
||||
{ inputs, ... }:
|
||||
{
|
||||
home-manager.users.${user} = {
|
||||
programs.direnv = {
|
||||
enable = true;
|
||||
silent = true;
|
||||
nix-direnv.enable = true;
|
||||
enableZshIntegration = true;
|
||||
};
|
||||
|
||||
# https://github.com/direnv/direnv/wiki/Customizing-cache-location
|
||||
xdg.configFile."direnv/direnvrc".text = ''
|
||||
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}/.local/share/direnv/allow" = { };
|
||||
"/cache"."${home}/.cache/direnv" = { };
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user