Installing into a nspawn container For installing a NixOS into a systemd nspawn container the NixOS installation tools are needed. If you run another distribution than NixOS on your host, please follow steps 1, 2, and 3. Create a NixOS configuration file /var/lib/machines/my-container/etc/nixos/configuration.nix. It is important that the container root file system is under /var/lib/machines. This is the standard location where machinectl will look for containers. If you choose place the root into another location you need to start the container directly with systemd-nspawn. The file needs to have at least following options enabled: = true; = true; If your host uses systemd-networkd to configure the network, you can also enable to use networkd default network configuration for your host and container. Install the container by running following command: nixos-install --root /var/lib/machines/my-container \ --no-channel-copy --no-root-passwd --no-bootloader Start the container by running following command: machinectl start my-container