I want to know if I can get a docker image with NixOS on it
I want something like
FROM nixos/nixos
COPY configuration.nix /etc/nixos/configuration.nix
RUN nixos-rebuild switch
CMD ["echo", "maybe just run nginx"]
I want to know if I can get a docker image with NixOS on it
I want something like
FROM nixos/nixos
COPY configuration.nix /etc/nixos/configuration.nix
RUN nixos-rebuild switch
CMD ["echo", "maybe just run nginx"]
nixos-generators can help you build a docker image.
I literally just finished this today: GitHub - TRPB/docker-nixos: Run an arbitrary NixOS configuration in a docker container
You can provide an arbitrary configuration.nix or flake and it will be built and activated via nixos-rebuild switch on startup.
The nixos/nixos
base image is not actually NixOS, it contains the package manager but not the full OS. Probably because running systemd in docker is a bit of a pain (see the limitation section in the readme on the repo)