mirror of
https://github.com/vale981/poetry2nix
synced 2025-03-06 17:51:40 -05:00
26 lines
940 B
Nix
26 lines
940 B
Nix
{ lib, poetry2nix, python3 }:
|
|
|
|
poetry2nix.mkPoetryApplication {
|
|
python = python3;
|
|
pyproject = ./pyproject.toml;
|
|
poetrylock = ./poetry.lock;
|
|
src = lib.cleanSource ./.;
|
|
# Workaround `ModuleNotFoundError: No module named 'poetry'`
|
|
# cf. https://github.com/nix-community/poetry2nix/blob/master/docs/edgecases.md#modulenotfounderror-no-module-named-packagename
|
|
overrides =
|
|
let
|
|
pypkgs-build-requirements = {
|
|
pytest-metadata = [ "poetry" ];
|
|
pytest-select = [ "poetry" ];
|
|
};
|
|
in
|
|
poetry2nix.defaultPoetryOverrides.extend (self: super:
|
|
builtins.mapAttrs
|
|
(package: build-requirements:
|
|
(builtins.getAttr package super).overridePythonAttrs (old: {
|
|
buildInputs = (old.buildInputs or [ ]) ++ (builtins.map (pkg: if builtins.isString pkg then builtins.getAttr pkg super else pkg) build-requirements);
|
|
})
|
|
)
|
|
pypkgs-build-requirements
|
|
);
|
|
}
|