homeFilesFromStringAttrs: first implementation

This commit is contained in:
2026-08-30 02:08:51 +01:00
parent 6bb0221b27
commit dd4f3fd46b
+11 -2
View File
@@ -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;
}; };
} }