diff --git a/modules/drv-parts/pip/default.nix b/modules/drv-parts/pip/default.nix index 9c5aed0f..b5b04ba7 100644 --- a/modules/drv-parts/pip/default.nix +++ b/modules/drv-parts/pip/default.nix @@ -9,6 +9,20 @@ python = config.deps.python; metadata = config.lock.content.fetchPipMetadata; + ignored = l.genAttrs cfg.ignoredDependencies (name: true); + + filterTarget = target: + l.filterAttrs (name: target: ! ignored ? ${name}) target; + + # filter out ignored dependencies + targets = l.flip l.mapAttrs metadata.targets ( + targetName: target: + l.flip l.mapAttrs (filterTarget target) ( + packageName: deps: + l.filter (dep: ! ignored ? ${dep}) deps + ) + ); + writers = import ../../../pkgs/writers { inherit lib; inherit @@ -64,6 +78,7 @@ gawk path stdenv + unzip writeScript writeScriptBin ; @@ -129,9 +144,9 @@ in { if targets.default ? ${config.name} then throw '' - Top-level package ${config.name} is listed in the lockfile. - Set `pip.flattenDependencies` to false to use only the top-level dependencies. - '' + Top-level package ${config.name} is listed in the lockfile. + Set `pip.flattenDependencies` to false to use only the top-level dependencies. + '' else let topLevelDepNames = l.attrNames (targets.default); in @@ -139,9 +154,9 @@ in { else if ! targets.default ? ${config.name} then throw '' - Top-level package ${config.name} is not listed in the lockfile. - Set `pip.flattenDependencies` to true to use all dependencies for the top-level package. - '' + Top-level package ${config.name} is not listed in the lockfile. + Set `pip.flattenDependencies` to true to use all dependencies for the top-level package. + '' else []; }; }; diff --git a/modules/drv-parts/pip/interface.nix b/modules/drv-parts/pip/interface.nix index 7a5976b1..6ec04cf5 100644 --- a/modules/drv-parts/pip/interface.nix +++ b/modules/drv-parts/pip/interface.nix @@ -16,6 +16,13 @@ in { ''; default = false; }; + ignoredDependencies = l.mkOption { + type = t.listOf t.str; + description = '' + list of dependencies to ignore + ''; + default = ["wheel"]; + }; pypiSnapshotDate = l.mkOption { type = t.str; description = ''