1# Building a NixOS (Live) ISO {#sec-building-image} 2 3Default live installer configurations are available inside `nixos/modules/installer/cd-dvd`. 4For building other system images, [nixos-generators] is a good place to start looking at. 5 6You have two options: 7 8- Use any of those default configurations as is 9- Combine them with (any of) your host config(s) 10 11System images, such as the live installer ones, know how to enforce configuration settings 12on wich they immediately depend in order to work correctly. 13 14However, if you are confident, you can opt to override those 15enforced values with `mkForce`. 16 17[nixos-generators]: https://github.com/nix-community/nixos-generators 18 19## Practical Instructions {#sec-building-image-instructions} 20 21```ShellSession 22$ git clone https://github.com/NixOS/nixpkgs.git 23$ cd nixpkgs/nixos 24$ nix-build -A config.system.build.isoImage -I nixos-config=modules/installer/cd-dvd/installation-cd-minimal.nix default.nix 25``` 26 27To check the content of an ISO image, mount it like so: 28 29```ShellSession 30# mount -o loop -t iso9660 ./result/iso/cd.iso /mnt/iso 31``` 32 33## Technical Notes {#sec-building-image-tech-notes} 34 35The config value enforcement is implemented via `mkImageMediaOverride = mkOverride 60;` 36and therefore primes over simple value assignments, but also yields to `mkForce`. 37 38This property allows image designers to implement in semantically correct ways those 39configuration values upon which the correct functioning of the image depends. 40 41For example, the iso base image overrides those file systems which it needs at a minimum 42for correct functioning, while the installer base image overrides the entire file system 43layout because there can't be any other guarantees on a live medium than those given 44by the live medium itself. The latter is especially true befor formatting the target 45block device(s). On the other hand, the netboot iso only overrides its minimum dependencies 46since netboot images are always made-to-target.