poetry2nix/pkgs/poetry/default.nix

41 lines
1.2 KiB
Nix
Raw Normal View History

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
poetry2nix.mkPoetryApplication {
2019-11-19 14:50:31 +00:00
inherit python;
projectDir = ./.;
2019-11-19 14:50:31 +00:00
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 = ''
for path in ''${PYTHONPATH//:/ }; do echo $path; done | uniq | while read path; do
2019-11-19 14:50:31 +00:00
echo "sys.path.insert(0, \"$path\")" >> poetry/__init__.py
done
'';
postInstall = ''
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-01-18 22:12:40 +00:00
maintainers = with maintainers; [ adisbladis jakewaksbaum ];
2019-11-19 14:50:31 +00:00
};
}