2022-01-13 20:06:32 +00:00
|
|
|
{ lib
|
2023-01-20 10:41:00 +00:00
|
|
|
, python3
|
2023-03-15 16:39:30 +00:00
|
|
|
, fetchFromGitHub
|
2023-07-15 17:15:38 +00:00
|
|
|
, fetchPypi
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
2023-01-20 10:41:00 +00:00
|
|
|
let
|
2023-02-02 18:25:31 +00:00
|
|
|
python = python3.override {
|
|
|
|
packageOverrides = self: super: {
|
2023-02-09 11:40:11 +00:00
|
|
|
poetry = self.callPackage ./unwrapped.nix { };
|
|
|
|
|
|
|
|
# version overrides required by poetry and its plugins
|
2023-10-09 19:29:22 +00:00
|
|
|
deepdiff = super.deepdiff.overridePythonAttrs (old: rec {
|
|
|
|
doCheck = false;
|
2023-08-10 07:59:29 +00:00
|
|
|
});
|
2023-03-24 00:07:29 +00:00
|
|
|
poetry-core = super.poetry-core.overridePythonAttrs (old: rec {
|
2023-10-09 19:29:22 +00:00
|
|
|
version = "1.7.0";
|
2023-03-24 00:07:29 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "python-poetry";
|
|
|
|
repo = "poetry-core";
|
|
|
|
rev = version;
|
2023-10-09 19:29:22 +00:00
|
|
|
hash = "sha256-OfY2zc+5CgOrgbiPVnvMdT4h1S7Aek8S7iThl6azmsk=";
|
2023-03-24 00:07:29 +00:00
|
|
|
};
|
2023-07-15 17:15:38 +00:00
|
|
|
patches = [ ];
|
2023-03-24 00:07:29 +00:00
|
|
|
});
|
2023-07-15 17:15:38 +00:00
|
|
|
} // (plugins self);
|
2023-02-02 18:25:31 +00:00
|
|
|
};
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
plugins = ps: with ps; {
|
2023-02-09 11:40:11 +00:00
|
|
|
poetry-audit-plugin = callPackage ./plugins/poetry-audit-plugin.nix { };
|
2023-07-15 17:15:38 +00:00
|
|
|
poetry-plugin-export = callPackage ./plugins/poetry-plugin-export.nix { };
|
2023-02-09 11:40:11 +00:00
|
|
|
poetry-plugin-up = callPackage ./plugins/poetry-plugin-up.nix { };
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2023-02-09 11:40:11 +00:00
|
|
|
# selector is a function mapping pythonPackages to a list of plugins
|
|
|
|
# e.g. poetry.withPlugins (ps: with ps; [ poetry-plugin-up ])
|
|
|
|
withPlugins = selector: let
|
2023-07-15 17:15:38 +00:00
|
|
|
selected = selector (plugins python.pkgs);
|
2023-02-09 11:40:11 +00:00
|
|
|
in python.pkgs.toPythonApplication (python.pkgs.poetry.overridePythonAttrs (old: {
|
|
|
|
propagatedBuildInputs = old.propagatedBuildInputs ++ selected;
|
2023-01-20 10:41:00 +00:00
|
|
|
|
2023-02-09 11:40:11 +00:00
|
|
|
# save some build time when adding plugins by disabling tests
|
|
|
|
doCheck = selected == [ ];
|
2022-01-13 20:06:32 +00:00
|
|
|
|
2023-02-09 11:40:11 +00:00
|
|
|
# Propagating dependencies leaks them through $PYTHONPATH which causes issues
|
|
|
|
# when used in nix-shell.
|
|
|
|
postFixup = ''
|
|
|
|
rm $out/nix-support/propagated-build-inputs
|
|
|
|
'';
|
2022-10-30 15:09:59 +00:00
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
passthru = {
|
|
|
|
plugins = plugins python.pkgs;
|
|
|
|
inherit withPlugins python;
|
2023-02-09 11:40:11 +00:00
|
|
|
};
|
|
|
|
}));
|
|
|
|
in withPlugins (ps: [ ])
|