NixOS automatic unattended offline installer USB stick

Hi there,

inspired by this here, i aimed towards creating an ISO image that automatically installs a given NixOS configuration to a system automatically in unattended fashion without need for internet access.

There is an older repository which does this already (, but i found that a bit too complicated as i thought it should be possible with less nix expressionery.

I was successful:

But i am not completely sure about a few steps and would like to hear some opinions by more experienced Nix users on the following points:

  • Is this really a generic offline-capable image now, or does it only work offline by accident?
  • I find my workaround that gets the system closure to hard disk before running nixos-install ( a bit clumsy. Is there a better way to express this, maybe single command?
  • i put all kinds of things into the hardware-configuration.nix file in order to make the closure capable of installing the right drivers on various hardware. During installation, the installer will create a new automatically generated hardware-configuration.nix which is hopefully only a subset of the one that i provide at generation time. Are there better ways?

Best regards


On your second point, you might want to take a look at make-disk-image.nix.