mirror of
https://github.com/nix-community/dream2nix.git
synced 2024-11-26 22:31:39 +03:00
feat: allow to split buildInputs in python derivations
Follow-up of https://github.com/nix-community/dream2nix/pull/676#discussion_r1326998054, now dependencies marked as buildInputs won't be included as propagatedBuildInputs for python derivations.
This commit is contained in:
parent
56308a22ef
commit
16552e5813
@ -11,6 +11,8 @@
|
|||||||
|
|
||||||
# filter out ignored dependencies
|
# filter out ignored dependencies
|
||||||
targets = cfg.targets;
|
targets = cfg.targets;
|
||||||
|
isRootDrv = drv: cfg.rootDependencies.${drv.name} or false;
|
||||||
|
isBuildInput = drv: cfg.buildDependencies.${drv.name} or false;
|
||||||
|
|
||||||
writers = import ../../../pkgs/writers {
|
writers = import ../../../pkgs/writers {
|
||||||
inherit lib;
|
inherit lib;
|
||||||
@ -159,10 +161,21 @@ in {
|
|||||||
};
|
};
|
||||||
|
|
||||||
mkDerivation = {
|
mkDerivation = {
|
||||||
propagatedBuildInputs = let
|
buildInputs = let
|
||||||
rootDeps = lib.filterAttrs (_: x: x == true) cfg.rootDependencies;
|
rootDeps =
|
||||||
|
lib.filterAttrs
|
||||||
|
(name: value: isRootDrv value && isBuildInput value)
|
||||||
|
cfg.drvs;
|
||||||
in
|
in
|
||||||
l.attrValues (l.mapAttrs (name: _: cfg.drvs.${name}.public.out) rootDeps);
|
l.map (drv: drv.public.out) (l.attrValues rootDeps);
|
||||||
|
|
||||||
|
propagatedBuildInputs = let
|
||||||
|
rootDeps =
|
||||||
|
lib.filterAttrs
|
||||||
|
(name: value: isRootDrv value && !isBuildInput value)
|
||||||
|
cfg.drvs;
|
||||||
|
in
|
||||||
|
l.map (drv: drv.public.out) (l.attrValues rootDeps);
|
||||||
};
|
};
|
||||||
|
|
||||||
public.pyEnv = let
|
public.pyEnv = let
|
||||||
|
@ -59,6 +59,38 @@ in {
|
|||||||
list of requirements.txt files
|
list of requirements.txt files
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
buildDependencies = l.mkOption {
|
||||||
|
type = t.attrsOf t.bool;
|
||||||
|
default = {
|
||||||
|
cython = true;
|
||||||
|
flit-core = true;
|
||||||
|
flit-scm = true;
|
||||||
|
hatch-fancy-pypi-readme = true;
|
||||||
|
hatch-nodejs-version = true;
|
||||||
|
hatch-vcs = true;
|
||||||
|
hatchling = true;
|
||||||
|
pbr = true;
|
||||||
|
pdm-pep517 = true;
|
||||||
|
poetry-core = true;
|
||||||
|
poetry-dynamic-versioning = true;
|
||||||
|
setuptools = true;
|
||||||
|
setuptools-odoo = true;
|
||||||
|
setuptools-scm = true;
|
||||||
|
versioneer = true;
|
||||||
|
wheel = true;
|
||||||
|
};
|
||||||
|
description = ''
|
||||||
|
python packages to be added only as buildInputs.
|
||||||
|
These should be somehow installable from `requirementsList` or
|
||||||
|
`requirementsFiles` too; listing them here doesn't do that automatically.
|
||||||
|
'';
|
||||||
|
example = lib.literalExpression ''
|
||||||
|
{
|
||||||
|
setuptools-scm = false; # To disable the default
|
||||||
|
easy_install = true; # To select easy_install as a buildInput
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
buildExtras = l.mkOption {
|
buildExtras = l.mkOption {
|
||||||
type = t.listOf t.str;
|
type = t.listOf t.str;
|
||||||
|
Loading…
Reference in New Issue
Block a user