homeFilesFromStringAttrs: first implementation
This commit is contained in:
@@ -5,7 +5,7 @@
|
|||||||
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
|
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = { self, nixpkgs }: {
|
outputs = { self, nixpkgs }: rec {
|
||||||
mkIfElse = with nixpkgs.lib; p: yes: no: mkMerge [
|
mkIfElse = with nixpkgs.lib; p: yes: no: mkMerge [
|
||||||
(mkIf p yes)
|
(mkIf p yes)
|
||||||
(mkIf (!p) no)
|
(mkIf (!p) no)
|
||||||
@@ -18,6 +18,15 @@
|
|||||||
ln -s ${source} ${target}
|
ln -s ${source} ${target}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
attrByStrPath = strPath: set: nixpkgs.lib.attrsets.attrByPath (nixpkgs.lib.strings.splitString "." strPath) null set;
|
attrByStrPath = strPath: set: nixpkgs.lib.attrByPath (nixpkgs.lib.strings.splitString "." strPath) null set;
|
||||||
|
|
||||||
|
setAttrByStrPath = strPath: value: nixpkgs.lib.setAttrByPath (nixpkgs.lib.strings.splitString "." strPath) value;
|
||||||
|
|
||||||
|
homeFilesFromStringAttrs = { dir, attrs, exec ? false }: map (x: (map (y: {
|
||||||
|
"${dir}/${x}" = {
|
||||||
|
text = y;
|
||||||
|
executable = exec;
|
||||||
|
};
|
||||||
|
}) builtins.attrValues attrs) ) builtins.attrNames attrs;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user