52 lines
988 B
Nix
Raw Normal View History

2025-07-13 16:07:25 -04:00
{
config,
lib,
pkgs,
...
}:
let
direnv_zsh_hook = pkgs.writeTextFile {
name = "direnv_zsh_hook.zsh";
text = ''
eval "$(direnv hook zsh)"
'';
};
in
{
imports = [ ];
options.me = {
direnv.enable = lib.mkOption {
type = lib.types.bool;
default = false;
example = true;
description = "Whether we want to install direnv.";
};
};
config = lib.mkIf config.me.direnv.enable {
environment.systemPackages = with pkgs; [
direnv
nix-direnv
];
2025-07-13 16:07:25 -04:00
me.zsh.includes = [ direnv_zsh_hook ];
2025-07-13 16:07:25 -04:00
environment.persistence."/persist" = lib.mkIf (config.me.mountPersistence) {
hideMounts = true;
users.talexander = {
directories = [
{
# List of allowed directories from `direnv allow`.
directory = ".local/share/direnv";
user = "talexander";
group = "talexander";
mode = "0755";
}
];
};
};
};
2025-07-13 16:07:25 -04:00
}