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

View File

@@ -14,5 +14,6 @@ in systemAttrs // {
userfullname = "Ryan Yin";
useremail = "xiaoyin_c@qq.com";
inherit systemAttrs;
allSystems = builtins.attrValues systemAttrs;
}

View File

@@ -18,20 +18,14 @@
}
// inputs;
allSystemSpecialArgs = builtins.listToAttrs (
map
(attr: {
name = attr + "_specialArgs";
value = specialArgsForSystem constants.${attr};
})
[
"x64_system"
"aarch64_system"
"riscv64_system"
"x64_darwin"
"aarch64_darwin"
]
);
# mapAttrs'
# (name: value: nameValuePair ("foo_" + name) ("bar-" + value))
# { x = "a"; y = "b"; }
# => { foo_x = "bar-a"; foo_y = "bar-b"; }
allSystemSpecialArgs = with lib.attrsets;
mapAttrs'
(name: value: nameValuePair (name + "_specialArgs") (specialArgsForSystem value))
constants.systemAttrs;
args = lib.attrsets.mergeAttrsList [
inputs