How to include files in docker containers created with nix?

Hi! in a dockerfile, adding files to the container from the local directory is straightforward. How do I do this with nix? Also, how would I include a local shell file as the entrypoint of the build docker image?

To include files, assign them to the copyToRoot attribute.

For some good examples see also:

The issue ended up being that the documentation for the nix language has a big gap between teaching basic syntax and teaching actual use of the standard library. Utility functions like builtins.readFile are very difficult to find

For OP or anyone else, you can use copyToRoot and a derivation to copy files to a docker image.