Convert list of strings of absolute paths to source directory

What’s the best way to convert a list of absolute paths as strings like:

[ "/foo/README.md" "/foo/blog.md" "/foo/docs/alert-manager.md" ]

…to a source directory (in the spirit of builtins.path and company) where each file would get copied to /nix/store under a directory like /nix/store/abc123-source/{foo/README.md,foo/blog.md,foo/docs/alert-manager.md}.

The best practice is probably not to end up with such a list in the first place.

What’s your use case? It looks like there must almost certainly be a better way of doing this, the files are all ij the same top level directory.