1# Building Images with `nixos-rebuild build-image` {#sec-image-nixos-rebuild-build-image} 2 3Nixpkgs contains a variety of modules to build custom images for different virtualization platforms and cloud providers, such as e.g. `amazon-image.nix` and `proxmox-lxc.nix`. 4 5While those can be imported directly, `system.build.images` provides an attribute set mapping variant names to image derivations. Available variants are defined - end extendable - in `image.modules`, an attribute set mapping variant names to NixOS modules. 6 7All of those images can be built via both, their `system.build.image` attribute and the `nixos-rebuild build-image` command. 8 9For example, to build an Amazon image from your existing NixOS configuration, run: 10 11```ShellSession 12$ nixos-rebuild build-image --image-variant amazon 13[...] 14Done. The disk image can be found in /nix/store/[hash]-nixos-image-amazon-25.05pre-git-x86_64-linux/nixos-image-amazon-25.05pre-git-x86_64-linux.vpc 15``` 16 17To get a list of all variants available, run `nixos-rebuild build-image` without arguments. 18 19::: {.example #ex-nixos-rebuild-build-image-customize} 20 21## Customize specific image variants {#sec-image-nixos-rebuild-build-image-customize} 22 23The `image.modules` option can be used to set specific options per image variant, in a similar fashion as [specialisations](options.html#opt-specialisation) for generic NixOS configurations. 24 25E.g. images for the cloud provider Linode use `grub2` as a bootloader by default. If you are using `systemd-boot` on other platforms and want to disable it for Linode only, you could use the following options: 26 27``` nix 28 image.modules.linode = { 29 boot.loader.systemd-boot.enable = lib.mkForce false; 30 }; 31```