How to run chown for docker image built with streamLayeredImage (or buildLayeredImage)?

I implemented a feature that allows modifying owners of files created by customization layer.
Instead of allowing customizing tar command, I just changed tar command to run inside fakeroot, and allowed running arbitrary command (fakeRootCommands) before tar.

By running chown inside fakeroot environment, you can set owner of any files in the archive. fakeroot thinks that files are owned by root if you don’t specify fakeRootCommands.

https://github.com/NixOS/nixpkgs/pull/116749