From 16cbe77aa09a0a24c7cb939c73d6e392479def50 Mon Sep 17 00:00:00 2001 From: Astro Date: Thu, 28 Apr 2022 23:59:17 +0200 Subject: [PATCH] profiles: split identifyProfiles into identifyProfile --- profiles.nix | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/profiles.nix b/profiles.nix index 00440e4..a76b0a7 100644 --- a/profiles.nix +++ b/profiles.nix @@ -21,19 +21,21 @@ in rec { ) hashes; # 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: let - matches = - 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); + matches = identifyProfiles profile; in if builtins.length matches == 1 then builtins.head matches