diff --git a/builder/shell-for.nix b/builder/shell-for.nix index bafd0d7cc8..2daf161f56 100644 --- a/builder/shell-for.nix +++ b/builder/shell-for.nix @@ -55,19 +55,20 @@ let (builtins.map (x: lib.nameValuePair (x.name) x) (haskellLib.flatLibDepends {depends = directlySelectedComponents;})); + isSelectedComponent = + comp: selectedComponentsBitmap."${((haskellLib.dependToLib comp).name or null)}" or false; selectedComponentsBitmap = lib.mapAttrs - (_: x: (builtins.any - (dep: selectedComponentsBitmap."${(haskellLib.dependToLib dep).name}") x.config.depends)) + (_: x: (builtins.any isSelectedComponent x.config.depends)) transitiveDependenciesComponents // builtins.listToAttrs (map (x: lib.nameValuePair x.name true) directlySelectedComponents); # base case selectedComponents = - lib.filter (x: selectedComponentsBitmap."${x.name}") (lib.attrValues transitiveDependenciesComponents); + lib.filter isSelectedComponent (lib.attrValues transitiveDependenciesComponents); # Given a list of `depends`, removes those which are selected components removeSelectedInputs = - lib.filter (input: !(selectedComponentsBitmap."${((haskellLib.dependToLib input).name or null)}" or false)); + lib.filter (input: !(isSelectedComponent input)); # The configs of all the selected components selectedConfigs = map (c: c.config) selectedComponents diff --git a/lib/default.nix b/lib/default.nix index 359367d512..92e9e77ba2 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -132,14 +132,7 @@ in { ## flatLibDepends :: Component -> [Package] flatLibDepends = component: let - # this is a minor improvement over the "cannot coerce set to string" - # error. It will now say: - # - # > The option `packages.Win32.package.identifier.name' is used but not defined. - # - # which indicates that the package.Win32 is missing and not defined. - getKey = x: if x ? "outPath" then "${x}" else (throw x.identifier.name); - makePairs = map (p: rec { key=getKey val; val=(p.components.library or p); }); + makePairs = map (p: rec { key=val.name; val=(p.components.library or p); }); closure = builtins.genericClosure { startSet = makePairs component.depends; operator = {val,...}: makePairs val.config.depends;