inspired by this here https://github.com/snabblab/snabblab-nixos/blob/259ef17a634c5ad17fe130821babd11803c92153/make-iso.nix, 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 (https://github.com/r-tr/nixos-config), but i found that a bit too complicated as i thought it should be possible with less nix expressionery.
I was successful: https://github.com/tfc/nixos-offline-installer-experiment
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 (https://github.com/tfc/nixos-offline-installer-experiment/blob/616dc8d6fe7937230222c7eadcb0dd111fdb8138/installer-configuration.nix#L94) 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?