localBinFromStringAttrs: first iteration, convenient wrapper
This commit is contained in:
@@ -22,11 +22,19 @@
|
||||
|
||||
setAttrByStrPath = strPath: value: nixpkgs.lib.setAttrByPath (nixpkgs.lib.strings.splitString "." strPath) value;
|
||||
|
||||
homeFilesFromStringAttrs = { dir, attrs, exec ? false }: mergeListsToAttrs (map (x: "${dir}/${x}") (builtins.attrNames attrs)) (map (x: {
|
||||
text = x;
|
||||
homeFilesFromStringAttrs = { dir, attrs, exec ? false }: mergeListsToAttrs (map (x: "${dir}/${x}") (builtins.attrNames attrs)) (map (y: {
|
||||
text = y;
|
||||
executable = exec;
|
||||
}) (builtins.attrValues attrs));
|
||||
|
||||
prependShebangToString = x: "#!/usr/bin/env bash\n" + x;
|
||||
|
||||
localBinFromStringAttrs = attrs: homeFilesFromStringAttrs {
|
||||
dir = ".local/bin";
|
||||
attrs = builtins.mapAttrs (name: value: prependShebangToString value) attrs;
|
||||
exec = true;
|
||||
};
|
||||
|
||||
mergeListsToAttrs = names: values: nixpkgs.lib.listToAttrs (nixpkgs.lib.zipListsWith (name: value: { inherit name value; }) names values);
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user