Add layout_poetry to direnv
Give direnv knowledge of how to use Poetry
This commit is contained in:
@@ -4,5 +4,18 @@
|
||||
programs.direnv = {
|
||||
enable = true;
|
||||
nix-direnv.enable = true;
|
||||
stdlib = ''
|
||||
layout_poetry() {
|
||||
if [[ ! -f pyproject.toml ]]; then
|
||||
echo "No pyproject.toml found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
venv="$(dirname "$(poetry run which python)")"
|
||||
export VIRTUAL_ENV="$(echo "$venv" | rev | cut -d'/' -f2- | rev)"
|
||||
export POETRY_ACTIVE=1
|
||||
PATH_add "$venv"
|
||||
}
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user