dotfiles/modules/common/shell/direnv.nix

33 lines
881 B
Nix
Raw Normal View History

2022-05-06 13:29:25 +00:00
{ config, ... }: {
2023-07-31 00:26:23 +00:00
# Enables quickly entering Nix shells when changing directories
2022-05-06 13:29:25 +00:00
home-manager.users.${config.user}.programs.direnv = {
enable = true;
nix-direnv.enable = true;
2022-05-29 17:44:45 +00:00
config = { whitelist = { prefix = [ config.dotfilesPath ]; }; };
2022-05-06 13:29:25 +00:00
};
# programs.direnv.direnvrcExtra = ''
# layout_postgres() {
# export PGDATA="$(direnv_layout_dir)/postgres"
# export PGHOST="$PGDATA"
#
# if [[ ! -d "PGDATA" ]]; then
# initdb
# cat >> "$PGDATA/postgres.conf" <<- EOF
# listen_addresses = '''
# unix_socket_directories = '$PGHOST'
# EOF
# echo "CREATE DATABASE $USER;" | postgres --single -E postgres
# fi
# }
# '';
2023-03-08 22:43:30 +00:00
# Prevent garbage collection
nix.extraOptions = ''
keep-outputs = true
keep-derivations = true
'';
2022-05-06 13:29:25 +00:00
}