templates/python: improve shell.nix

This commit is contained in:
DavHau
2023-07-21 01:57:39 +02:00
parent 178df2eccb
commit cf583e2d44
2 changed files with 11 additions and 13 deletions

View File

@@ -27,19 +27,17 @@
shellHook = ''
tmp_path=$(realpath ./.pythonenv)
repo_root=$(realpath .)
if ! cmp -s pyproject.toml $tmp_path/pyproject.toml; then
rm -rf $tmp_path
mkdir -p "$tmp_path/${pythonWithDeps.sitePackages}"
rm -rf $tmp_path
mkdir -p "$tmp_path/${pythonWithDeps.sitePackages}"
${pythonWithDeps.interpreter} -m pip install \
--quiet \
--disable-pip-version-check \
--no-index \
--no-build-isolation \
--prefix "$tmp_path" \
--editable $repo_root
${pythonWithDeps.interpreter} -m pip install \
--quiet \
--disable-pip-version-check \
--no-index \
--no-build-isolation \
--prefix "$tmp_path" \
--editable $repo_root && \
cp -a pyproject.toml $tmp_path/pyproject.toml
fi
export PATH="$tmp_path/bin:${checkScript}/bin:$PATH"
export PYTHONPATH="$repo_root:$tmp_path/${pythonWithDeps.sitePackages}"
'';