feat: add flattenSetList

Using the function reduces continual use of lib.lists.flatten, by
applying it to each of the attributes of a set, assuming they contain lists.
This commit is contained in:
Infinidoge 2021-10-01 18:34:44 -04:00
parent 65dc0e36e4
commit ed97f22ac0
2 changed files with 18 additions and 16 deletions

View file

@ -142,24 +142,25 @@
modules = [ ]; modules = [ ];
importables = rec { importables = rec {
profiles = digga.lib.rakeLeaves ./users/profiles; profiles = digga.lib.rakeLeaves ./users/profiles;
suites = with profiles; rec { suites = with profiles; self.lib.flattenSetList
base = [ rec {
# Base Configuration base = [
xdg # Base Configuration
xdg
# Programs # Programs
direnv direnv
git git
pass pass
emacs emacs
gaming gaming
# Terminal # Terminal
kitty kitty
starship starship
shells.all shells.all
]; ];
}; };
}; };
users = { users = {
infinidoge = { }; infinidoge = { };

View file

@ -2,5 +2,6 @@
lib.makeExtensible (self: lib.makeExtensible (self:
{ {
flattenListSet = imports: (lib.lists.flatten (builtins.concatLists (builtins.attrValues imports))); flattenListSet = imports: (lib.lists.flatten (builtins.concatLists (builtins.attrValues imports)));
flattenSetList = attrSet: (builtins.mapAttrs (name: value: lib.lists.flatten value) attrSet);
} }
) )