profiles: split identifyProfiles into identifyProfile

This commit is contained in:
Astro 2022-04-28 23:59:17 +02:00
parent fd97d941cd
commit 16cbe77aa0
1 changed files with 13 additions and 11 deletions

View File

@ -21,19 +21,21 @@ in rec {
) hashes; ) hashes;
# filters hardware profiles from all boards.json files # filters hardware profiles from all boards.json files
identifyProfiles = profile:
builtins.concatMap (target:
map (variant: {
# match return value
inherit pkgs release target variant profile;
}) (
builtins.filter (variant:
allProfiles.${target}.${variant}.profiles ? ${profile}
) (builtins.attrNames allProfiles.${target})
)
) (builtins.attrNames allProfiles);
identifyProfile = profile: identifyProfile = profile:
let let
matches = matches = identifyProfiles profile;
builtins.concatMap (target:
map (variant: {
# match return value
inherit pkgs release target variant profile;
}) (
builtins.filter (variant:
allProfiles.${target}.${variant}.profiles ? ${profile}
) (builtins.attrNames allProfiles.${target})
)
) (builtins.attrNames allProfiles);
in in
if builtins.length matches == 1 if builtins.length matches == 1
then builtins.head matches then builtins.head matches