homeFilesFromStringAttrs: full rewrite to fix glaring mistake
also adds `mergeListsToAttrs`, which takes two lists and combines them into key-value pairs as an attrset
This commit is contained in:
@@ -22,11 +22,11 @@
|
|||||||
|
|
||||||
setAttrByStrPath = strPath: value: nixpkgs.lib.setAttrByPath (nixpkgs.lib.strings.splitString "." strPath) value;
|
setAttrByStrPath = strPath: value: nixpkgs.lib.setAttrByPath (nixpkgs.lib.strings.splitString "." strPath) value;
|
||||||
|
|
||||||
homeFilesFromStringAttrs = { dir, attrs, exec ? false }: nixpkgs.lib.mergeAttrsList (map (x: nixpkgs.lib.mergeAttrsList (map (y: {
|
homeFilesFromStringAttrs = { dir, attrs, exec ? false }: mergeListsToAttrs (map (x: "${dir}/${x}") (builtins.attrNames attrs)) (map (x: {
|
||||||
"${dir}/${x}" = {
|
text = x;
|
||||||
text = y;
|
executable = exec;
|
||||||
executable = exec;
|
}) (builtins.attrValues attrs));
|
||||||
};
|
|
||||||
}) (builtins.attrValues attrs)) ) (builtins.attrNames attrs));
|
mergeListsToAttrs = names: values: nixpkgs.lib.listToAttrs (nixpkgs.lib.zipListsWith (name: value: { inherit name value; }) names values);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user