mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-14 01:33:10 +00:00
571c71e6f7
We are migrating packages that meet below requirements: 1. using `callPackage` 2. called path is a directory 3. overriding set is empty (`{ }`) 4. not containing path expressions other than relative path (to makenixpkgs-vet happy) 5. not referenced by nix files outside of the directory, other than`pkgs/top-level/all-packages.nix` 6. not referencing nix files outside of the directory 7. not referencing `default.nix` (since it's changed to `package.nix`) 8. `outPath` doesn't change after migration The tool is here: https://github.com/Aleksanaa/by-name-migrate.
60 lines
2.1 KiB
Nix
60 lines
2.1 KiB
Nix
{ lib, python3, fetchFromGitHub }:
|
|
|
|
let
|
|
newPackageOverrides =
|
|
self: super: {
|
|
poetry = self.callPackage ./unwrapped.nix { };
|
|
|
|
# The versions of Poetry and poetry-core need to match exactly,
|
|
# and poetry-core in nixpkgs requires a staging cycle to be updated,
|
|
# so apply an override here.
|
|
#
|
|
# We keep the override around even when the versions match, as
|
|
# it's likely to become relevant again after the next Poetry update.
|
|
poetry-core = super.poetry-core.overridePythonAttrs (old: rec {
|
|
version = "1.9.1";
|
|
src = fetchFromGitHub {
|
|
owner = "python-poetry";
|
|
repo = "poetry-core";
|
|
rev = "refs/tags/${version}";
|
|
hash = "sha256-L8lR9sUdRYqjkDCQ0XHXZm5X6xD40t1gxlGiovvb/+8=";
|
|
};
|
|
patches = [ ];
|
|
});
|
|
} // (plugins self);
|
|
python = python3.override (old: {
|
|
self = python;
|
|
packageOverrides = lib.composeManyExtensions
|
|
((if old ? packageOverrides then [ old.packageOverrides ] else [ ]) ++ [ newPackageOverrides ]);
|
|
});
|
|
|
|
plugins = ps: with ps; {
|
|
poetry-audit-plugin = callPackage ./plugins/poetry-audit-plugin.nix { };
|
|
poetry-plugin-export = callPackage ./plugins/poetry-plugin-export.nix { };
|
|
poetry-plugin-up = callPackage ./plugins/poetry-plugin-up.nix { };
|
|
poetry-plugin-poeblix = callPackage ./plugins/poetry-plugin-poeblix.nix { };
|
|
};
|
|
|
|
# selector is a function mapping pythonPackages to a list of plugins
|
|
# e.g. poetry.withPlugins (ps: with ps; [ poetry-plugin-up ])
|
|
withPlugins = selector: let
|
|
selected = selector (plugins python.pkgs);
|
|
in python.pkgs.toPythonApplication (python.pkgs.poetry.overridePythonAttrs (old: {
|
|
dependencies = old.dependencies ++ selected;
|
|
|
|
# save some build time when adding plugins by disabling tests
|
|
doCheck = selected == [ ];
|
|
|
|
# Propagating dependencies leaks them through $PYTHONPATH which causes issues
|
|
# when used in nix-shell.
|
|
postFixup = ''
|
|
rm $out/nix-support/propagated-build-inputs
|
|
'';
|
|
|
|
passthru = {
|
|
plugins = plugins python.pkgs;
|
|
inherit withPlugins python;
|
|
};
|
|
}));
|
|
in withPlugins (ps: [ ])
|