Hi Folks, I’d like to create a docker image that has an option to run a developer shell that matches a nix-shell environment. I tried doing something like this:
If build build this image, and load it in podman, I get a very simple bash shell that lacks any of the NIX environment variables needed for gcc to find the openssl library and headers:
nix-shell does a lot more than just get some programs into PATH… it sets up environment variables and shell functions to do all sorts of things, runs hooks, and probably more I’m not thinking of.
If you want a nix-shell environment, the only realistic way to get it is to actually run nix-shell. So you would need the docker container to be capable of running nix, but at that point I question what the point is… why use docker for this?
Then let me reverse the question: why use nix-shell for this? If it’s not interactive, it seems like using nix derivations would be better.
If the build fails for some reason, it’s useful for developers to be able to pull the image down and run the build locally, so that can have the same process as the build machine uses - so the idea is to have a user-friendly shell as the default docker command.
I guess most people are just using dockerTools to deploy their software into Docker, rather than for this use case.