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-07-15 17:15:38 +00:00
|
|
|
cachecontrol = super.cachecontrol.overridePythonAttrs (old: rec {
|
|
|
|
version = "0.12.14";
|
|
|
|
format = "setuptools";
|
2023-03-15 16:39:30 +00:00
|
|
|
src = fetchFromGitHub {
|
2023-07-15 17:15:38 +00:00
|
|
|
owner = "ionrock";
|
|
|
|
repo = "cachecontrol";
|
|
|
|
rev = "v${version}";
|
|
|
|
hash = "sha256-BuBaKP7OAYoT+SPVhtE6l9U/KmN21OKTL6poV5a6+0c=";
|
2023-02-02 18:25:31 +00:00
|
|
|
};
|
2023-07-15 17:15:38 +00:00
|
|
|
nativeCheckInputs = old.nativeCheckInputs ++ [
|
|
|
|
self.lockfile
|
|
|
|
];
|
2023-02-02 18:25:31 +00:00
|
|
|
});
|
2023-03-24 00:07:29 +00:00
|
|
|
poetry-core = super.poetry-core.overridePythonAttrs (old: rec {
|
2023-07-15 17:15:38 +00:00
|
|
|
version = "1.6.1";
|
2023-03-24 00:07:29 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "python-poetry";
|
|
|
|
repo = "poetry-core";
|
|
|
|
rev = version;
|
2023-07-15 17:15:38 +00:00
|
|
|
hash = "sha256-Gc22Y2T4uO39jiOqEUFeOfnVCbknuDjmzFPZgk2eY74=";
|
2023-03-24 00:07:29 +00:00
|
|
|
};
|
2023-07-15 17:15:38 +00:00
|
|
|
patches = [ ];
|
|
|
|
nativeCheckInputs = old.nativeCheckInputs ++ [
|
|
|
|
self.tomli-w
|
|
|
|
];
|
2023-03-24 00:07:29 +00:00
|
|
|
});
|
2023-07-15 17:15:38 +00:00
|
|
|
virtualenv = super.virtualenv.overridePythonAttrs (old: rec {
|
|
|
|
version = "20.23.1";
|
|
|
|
src = fetchPypi {
|
|
|
|
inherit (old) pname;
|
|
|
|
inherit version;
|
|
|
|
hash = "sha256-j/GaOMECHHQhSO3E+By0PX+MaBbS7eKrcq9bhMdJreE=";
|
|
|
|
};
|
|
|
|
nativeCheckInputs = old.nativeCheckInputs ++ [
|
|
|
|
self.time-machine
|
|
|
|
];
|
|
|
|
});
|
|
|
|
} // (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: [ ])
|