From 71ec19170dbff47d3c283f3b9f8d175fc95841b8 Mon Sep 17 00:00:00 2001 From: Haak Saxberg Date: Mon, 24 Jun 2019 22:31:31 -0700 Subject: [PATCH] ignore envrcs by default; add a layout postgres helper for direnv --- nix/home.nix | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/nix/home.nix b/nix/home.nix index f517556..59792b9 100644 --- a/nix/home.nix +++ b/nix/home.nix @@ -16,6 +16,24 @@ with lib; zsh-syntax-highlighting ]; + programs.direnv = { + enable = true; + stdlib = '' + layout_postgres() { + export PGDATA="$(direnv_layout_dir)/tmp/pgdata" + export PGHOST="$PGDATA" + if [[ ! -d "$PGDATA" ]]; then + initdb --locale=$LANG + cat <<'EOF' >>"$PGDATA/postgresql.conf" + listen_addresses = 'localhost' + unix_socket_directories = '$PGHOST' + EOF + echo "CREATE DATABASE $USER;" | postgres --single -E postgres + fi + } + ''; + }; + programs.command-not-found.enable = true; programs.git = { @@ -25,6 +43,7 @@ with lib; ignores = [ ".idea/" ".direnv/" + ".envrc" ".tools-info" "*~" "*.swp" @@ -37,6 +56,7 @@ with lib; defaultKeymap = "viins"; initExtra = mkForce ('' + export LOCALE_ARCHIVE="/usr/lib/locale/locale-archive" export NIX_PATH=$HOME/.nix-defexpr/channels:$NIX_PATH export EDITOR=vim