refactor: replace listToAttrs with mapAttrs' to get a cleaner definition

This commit is contained in:
Ryan Yin
2023-12-22 01:23:15 +08:00
parent 05aa451895
commit e4abf62ec3
2 changed files with 9 additions and 14 deletions
+1
View File
@@ -14,5 +14,6 @@ in systemAttrs // {
userfullname = "Ryan Yin"; userfullname = "Ryan Yin";
useremail = "xiaoyin_c@qq.com"; useremail = "xiaoyin_c@qq.com";
inherit systemAttrs;
allSystems = builtins.attrValues systemAttrs; allSystems = builtins.attrValues systemAttrs;
} }
+8 -14
View File
@@ -18,20 +18,14 @@
} }
// inputs; // inputs;
allSystemSpecialArgs = builtins.listToAttrs ( # mapAttrs'
map # (name: value: nameValuePair ("foo_" + name) ("bar-" + value))
(attr: { # { x = "a"; y = "b"; }
name = attr + "_specialArgs"; # => { foo_x = "bar-a"; foo_y = "bar-b"; }
value = specialArgsForSystem constants.${attr}; allSystemSpecialArgs = with lib.attrsets;
}) mapAttrs'
[ (name: value: nameValuePair (name + "_specialArgs") (specialArgsForSystem value))
"x64_system" constants.systemAttrs;
"aarch64_system"
"riscv64_system"
"x64_darwin"
"aarch64_darwin"
]
);
args = lib.attrsets.mergeAttrsList [ args = lib.attrsets.mergeAttrsList [
inputs inputs