1
0
Fork 0
nixos-config/overlays/file-tree.nix
Malte Brandy 57123b08e1 Reformat
2022-03-08 02:42:46 +01:00

19 lines
479 B
Nix

final: prev: let
inherit (prev) lib;
linkToPath = path: fileOrDir: (
if lib.types.path.check fileOrDir
then ["ln -sT ${fileOrDir} ${path}"]
else
["mkdir -p ${path}"]
++ lib.concatLists (
lib.mapAttrsToList
(dirName: content: linkToPath "${path}/${dirName}" content)
fileOrDir
)
);
in {
setToDirectories = files:
prev.runCommand "set-to-directories" {}
(lib.concatStringsSep "\n" (linkToPath "$out" files));
}