I am in the process of converting custom Linux images from an Ansible build pipeline to NixOS. The image is used during programming contests, so the general idea is to build the image, flash a bunch of USB drives, and boot these to end up in a ready-to-use and fully set-up Linux environment.
One thing we do in our original Ansible environment is pull a Docker image during build, so that when we need to deploy the containers during the contest, Docker doesn’t first need to pull the image anymore. This is a huge timesaver. (How) can I achieve this on NixOS? There seems to be a pkgs.dockerTools.pullImage thing, but it seems like this is only for building something on top of it afterwards? I just want to store the image locally :).
You then should be able to run the preload-images command to load debian:buster image to the local docker daemon. Or you can call it in a oneshot systemd service
If I’m understanding this correctly, this is basically like writing a custom shell script? Is the preload-images then something that is available in the PATH or how does that work?
Additionally, how do I run the script during build so that even on first boot, the image is already present?
Lastly, what does the comment represent?
Sorry for the many questions, but I’m learning a lot these last few weeks
Thanks for the detailed answer! I really appreciate the help.
Would it then also be an option to define this as a normal Nix function and execute it as an activation script in home-manager? That way it would run during evaluation?