fix path again

This commit is contained in:
dusk 2022-07-30 13:55:09 +03:00
parent 0693dfe97e
commit 659b53680a
Signed by: dusk
GPG Key ID: 1D8F8FAF2294D6EA

View File

@ -15,12 +15,12 @@
inherit (utils) recursiveAttrPaths concatStringsSep map; inherit (utils) recursiveAttrPaths concatStringsSep map;
inherit (pkgs.lib) mapAttrsRecursive init last getAttrFromPath; inherit (pkgs.lib) mapAttrsRecursive init last getAttrFromPath;
convertToPath = value: convertToPath = path: value:
if builtins.isPath value if builtins.isPath value
then value then value
else pkgs.writeText (concatStringsSep "-" path) value; else pkgs.writeText (concatStringsSep "-" path) value;
fileAttrPaths = recursiveAttrPaths site; fileAttrPaths = recursiveAttrPaths site;
texts = mapAttrsRecursive (path: value: convertToPath value) site; texts = mapAttrsRecursive convertToPath site;
mkCreateFileCmd = path: value: let p = concatStringsSep "/" (init path); in "mkdir -p \"$out/${p}\" && ln -s \"${value}\" \"$out/${p}/${last path}\""; mkCreateFileCmd = path: value: let p = concatStringsSep "/" (init path); in "mkdir -p \"$out/${p}\" && ln -s \"${value}\" \"$out/${p}/${last path}\"";
createFileCmds = map (path: mkCreateFileCmd path (getAttrFromPath path texts)) fileAttrPaths; createFileCmds = map (path: mkCreateFileCmd path (getAttrFromPath path texts)) fileAttrPaths;
in in