Skip to content

Commit bed0a2d

Browse files
authored
Only redirect to buildable targets (#2356)
1 parent df3f71e commit bed0a2d

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

modules/install-plan/redirect.nix

+6-3
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ let
1818
else existing.${(builtins.head available).id}.components.${collectionName}.${name};
1919
componentsWithPrefix = collectionName: prefix:
2020
lib.listToAttrs (lib.concatLists (lib.mapAttrsToList (n: available:
21-
lib.optional (lib.hasPrefix "${prefix}:" n && (builtins.length available != 1 || !builtins.elem (builtins.head available) ["TargetNotBuildable" "TargetNotLocal"])) (
21+
lib.optional (lib.hasPrefix "${prefix}:" n && (builtins.length available != 1 || !builtins.elem (builtins.head available) ["TargetNotLocal"])) (
2222
let
2323
name = lib.removePrefix "${prefix}:" n;
2424
value = lookupComponent collectionName name available;
@@ -45,6 +45,9 @@ let
4545
(_: d: pkgs.haskell-nix.haskellLib.check d)
4646
(lib.filterAttrs (_: d: d.config.doCheck) components.tests)));
4747
};
48+
buildableTargets = lib.filter (x: x.available != []) (
49+
lib.map (x: x // { available = lib.filter (n: n != "TargetNotBuildable") x.available; })
50+
config.plan-json.targets);
4851
in {
4952
options.hsPkgs = lib.mkOption {
5053
type = lib.types.unspecified;
@@ -63,10 +66,10 @@ in {
6366
components = err;
6467
checks = err;
6568
}
66-
else redirect existing packageName packageTargets) (builtins.groupBy (x: x.pkg-name) config.plan-json.targets)) config.preExistingPkgs
69+
else redirect existing packageName packageTargets) (builtins.groupBy (x: x.pkg-name) buildableTargets)) config.preExistingPkgs
6770

6871
# Redirect for `${name}-${version}`
6972
// builtins.mapAttrs (packageNameAndVersion: packageTargets: redirect existing packageNameAndVersion packageTargets)
70-
(builtins.groupBy (x: "${x.pkg-name}-${x.pkg-version}") config.plan-json.targets);
73+
(builtins.groupBy (x: "${x.pkg-name}-${x.pkg-version}") buildableTargets);
7174
};
7275
}

0 commit comments

Comments
 (0)