fix(nixos): order homepage sections
This commit is contained in:
@@ -56,12 +56,37 @@ let
|
|||||||
|
|
||||||
orderedTabs = tabOrder ++ lib.filter (tab: !lib.elem tab tabOrder) (lib.attrNames entriesByTab);
|
orderedTabs = tabOrder ++ lib.filter (tab: !lib.elem tab tabOrder) (lib.attrNames entriesByTab);
|
||||||
|
|
||||||
|
sectionOrderByTab = {
|
||||||
|
Apps = [
|
||||||
|
"Media"
|
||||||
|
"Files"
|
||||||
|
"Other"
|
||||||
|
];
|
||||||
|
Download = [
|
||||||
|
"Library Managers"
|
||||||
|
"Other Utilities"
|
||||||
|
"Download Clients"
|
||||||
|
];
|
||||||
|
System = [
|
||||||
|
"Monitoring"
|
||||||
|
"Network"
|
||||||
|
"Machines"
|
||||||
|
"Docker"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
orderedSections = tab: sections:
|
||||||
|
let
|
||||||
|
sectionOrder = sectionOrderByTab.${tab} or [ ];
|
||||||
|
in
|
||||||
|
sectionOrder ++ lib.filter (section: !lib.elem section sectionOrder) (lib.attrNames sections);
|
||||||
|
|
||||||
mkTab = tab:
|
mkTab = tab:
|
||||||
let
|
let
|
||||||
sections = entriesByTab.${tab};
|
sections = entriesByTab.${tab};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
${tab} = map (section: { ${section} = sections.${section}; }) (lib.attrNames sections);
|
${tab} = map (section: { ${section} = sections.${section}; }) (orderedSections tab sections);
|
||||||
};
|
};
|
||||||
|
|
||||||
homepageServices = map mkTab (lib.filter (tab: lib.hasAttr tab entriesByTab) orderedTabs);
|
homepageServices = map mkTab (lib.filter (tab: lib.hasAttr tab entriesByTab) orderedTabs);
|
||||||
|
|||||||
Reference in New Issue
Block a user