| (builtins.split "\\\$\\{\\{([^}]*)}}") |
| if builtins.typeOf part == "string" |
| pkgs.writeText "generated.nix" ("pkgs: lib: " + (builtins.elemAt part 0)) |
| if builtins.typeOf part == "string" then part |
| else if builtins.typeOf part == "path" then |
| stringified = toString part; |
| builtins.toString (utils.interpolateFile ( |
| file + "/.." + (builtins.substring |
| (builtins.stringLength "/nix/store") |
| # ^ Somewhat of a hack, works because we know that the file path |
| # is a text file (i.e. not a directory) as we read it earlier and |
| # relative paths end up in /nix/store due to the writeText. Absolute |
| # paths are not supported |
| (builtins.concatStringsSep "") |