Skip to content

Commit

Permalink
Add direnv lib/ directory with poetry layout (#81)
Browse files Browse the repository at this point in the history
  • Loading branch information
jisantuc authored Nov 16, 2023
1 parent b757f2e commit d0df2c1
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
19 changes: 19 additions & 0 deletions dotfiles/direnv/lib/layout_poetry.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# poetry layout for direnv
# see https://github.com/direnv/direnv/issues/592#issuecomment-856227234
layout_poetry() {
if [[ ! -f pyproject.toml ]]; then
log_error 'No pyproject.toml found. Use `poetry new` or `poetry init` to create one first.'
exit 2
fi

local VENV=$(poetry env info --path)
if [[ -z $VENV || ! -d $VENV/bin ]]; then
log_error 'No poetry virtual environment found. Use `poetry install` to create one first.'
exit 2
fi

export VIRTUAL_ENV=$VENV
export POETRY_ACTIVE=1
PATH_add "$VENV/bin"
}

5 changes: 5 additions & 0 deletions home.nix
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@ in

xdg.configFile."lazygit/config.yml".text = builtins.readFile ./dotfiles/lazygit.yml;

xdg.configFile."direnv/lib" = {
source = ./dotfiles/direnv/lib;
recursive = true;
};

programs = {

# Let Home Manager install and manage itself.
Expand Down

0 comments on commit d0df2c1

Please sign in to comment.