found a better way

This commit is contained in:
2026-03-30 02:40:42 +09:00
parent edb3d75788
commit 8efe0b9341

View File

@@ -1,7 +1,7 @@
{ config, pkgs, lib, ... }:
let
inherit (builtins) map genList listToAttrs;
inherit (lib.lists) length imap0 forEach reverseList elemAt;
inherit (builtins) listToAttrs;
inherit (lib.lists) imap1 forEach reverseList elemAt;
modules = [
{
name = "time";
@@ -53,13 +53,9 @@ let
};
}
];
modulesLength = length modules;
modPositions = map (x:
{ position = x; }
) (reverseList (genList (x: x+1) modulesLength));
numberedModulesList = imap0 (i: v:
(elemAt modules i) // v
) modPositions;
numberedModulesList = imap1 (i: v:
v // { position = i; }
) (reverseList modules);
modNameValList = forEach numberedModulesList (x: {
name = x.name;
value = {
@@ -80,7 +76,7 @@ in
color_good = "#00FF00";
color_degraded = "#00FFFF";
color_bad = "#FF0000";
separator = "][";
separator = "";
};
modules = modAttr;
};