2020-02-29 22:09:44 +00:00
|
|
|
{ lib, poetry2nix, python, fetchFromGitHub }:
|
2019-11-19 14:50:31 +00:00
|
|
|
|
2020-01-18 22:12:40 +00:00
|
|
|
|
2019-12-16 11:23:09 +01:00
|
|
|
poetry2nix.mkPoetryApplication {
|
2019-11-19 14:50:31 +00:00
|
|
|
|
|
|
|
inherit python;
|
|
|
|
|
2020-02-28 07:57:34 +00:00
|
|
|
projectDir = ./.;
|
2019-11-19 14:50:31 +00:00
|
|
|
|
2020-07-14 15:27:47 +02:00
|
|
|
# Don't include poetry in inputs
|
|
|
|
__isBootstrap = true;
|
|
|
|
|
2020-01-18 22:12:40 +00:00
|
|
|
src = fetchFromGitHub (lib.importJSON ./src.json);
|
2019-11-19 14:50:31 +00:00
|
|
|
|
|
|
|
# "Vendor" dependencies (for build-system support)
|
|
|
|
postPatch = ''
|
2020-10-01 14:36:24 +02:00
|
|
|
echo "import sys" >> poetry/__init__.py
|
2020-11-24 19:31:05 +01:00
|
|
|
for path in $propagatedBuildInputs; do
|
|
|
|
echo "sys.path.insert(0, \"$path\")" >> poetry/__init__.py
|
2019-11-19 14:50:31 +00:00
|
|
|
done
|
|
|
|
'';
|
|
|
|
|
2020-02-28 07:57:34 +00:00
|
|
|
postInstall = ''
|
2020-10-01 17:17:28 +02:00
|
|
|
# Figure out the location of poetry.core
|
|
|
|
# As poetry.core is using the same root import name as the poetry package and the python module system wont look for the root
|
|
|
|
# in the separate second location we need to link poetry.core to poetry
|
|
|
|
ln -s $(python -c 'import poetry.core; import os.path; print(os.path.dirname(poetry.core.__file__))') $out/${python.sitePackages}/poetry/core
|
|
|
|
|
2019-11-19 14:50:31 +00:00
|
|
|
mkdir -p "$out/share/bash-completion/completions"
|
|
|
|
"$out/bin/poetry" completions bash > "$out/share/bash-completion/completions/poetry"
|
|
|
|
mkdir -p "$out/share/zsh/vendor-completions"
|
|
|
|
"$out/bin/poetry" completions zsh > "$out/share/zsh/vendor-completions/_poetry"
|
|
|
|
mkdir -p "$out/share/fish/vendor_completions.d"
|
|
|
|
"$out/bin/poetry" completions fish > "$out/share/fish/vendor_completions.d/poetry.fish"
|
|
|
|
'';
|
|
|
|
|
|
|
|
# Propagating dependencies leads to issues downstream
|
|
|
|
# We've already patched poetry to prefer "vendored" dependencies
|
|
|
|
postFixup = ''
|
|
|
|
rm $out/nix-support/propagated-build-inputs
|
|
|
|
'';
|
|
|
|
|
|
|
|
# Fails because of impurities (network, git etc etc)
|
|
|
|
doCheck = false;
|
|
|
|
|
|
|
|
meta = with lib; {
|
2020-06-09 00:03:36 +02:00
|
|
|
inherit (python.meta) platforms;
|
2020-01-18 22:12:40 +00:00
|
|
|
maintainers = with maintainers; [ adisbladis jakewaksbaum ];
|
2019-11-19 14:50:31 +00:00
|
|
|
};
|
|
|
|
}
|