mkSuites: generalize for one profile/suite pair

This commit is contained in:
Pacman99 2021-04-26 10:52:26 -07:00
parent 59383e871f
commit ba01aa7db7

View File

@ -1,20 +1,20 @@
{ lib }:
{ users, profiles, userProfiles, suites } @ args:
{ suites, profiles } @ args:
let
inherit (lib) os;
definedSuites = suites {
inherit (args) users profiles userProfiles;
};
profileSet = lib.genAttrs' profiles (path: {
name = baseNameOf path;
value = os.mkProfileAttrs (toString path);
});
allProfiles = lib.collectProfiles profiles;
allUsers = lib.collectProfiles users;
createSuites = _: suites: lib.mapAttrs (_: v: os.profileMap v) suites // {
inherit allProfiles allUsers;
};
definedSuites = suites profileSet;
allProfiles = lib.collectProfiles profileSet;
in
lib.mapAttrs createSuites definedSuites
lib.mapAttrs (_: v: os.profileMap v) definedSuites // {
inherit allProfiles;
}