nixos-generators Documentation

repository·master·Indexed 25 days ago

https://github.com/nix-community/nixos-generators

A tool previously used to build various NixOS system images such as ISO, cloud images, and VM images. Now deprecated as of NixOS 25.05, its functionality has been integrated into the core NixOS nixos-rebuild build-image command.

Tokens
405
Snippets
2
Records
4
Agent score
32%

What's inside nixos-generators

  1. Build an ISO image using nixos-rebuild

    master

    To build a standard ISO image, use the nixos-rebuild build-image command with the --image-variant iso flag.

    If you need to explicitly specify your NixOS configuration path and a specific nixpkgs checkout, use environment variables:

    NIX_PATH=nixpkgs=../nixpkgs NIXOS_CONFIG="/etc/nixos/nixos-configuration.nix" nixos-rebuild build-image --image-variant iso
    nixos-rebuild build-image --image-variant iso
  2. Build images from Flakes

    master

    When using Flakes, you can build an ISO image from a specific NixOS configuration defined in your flake output (e.g., nixosConfigurations.myhost) using the --flake flag.

    nixos-rebuild build-image --image-variant iso --flake .#myhost

    Alternatively, if you want to expose an installable package within your flake (similar to the old nixos-generators.nixosGenerate function), you can access the system.build.images attribute in your configuration:

    packages.x86_64-linux.myhost-iso = self.nixosConfigurations.myhost.config.system.build.images.iso
  3. Migrating from nixos-generators to nixos-rebuild build-image

    master
    As of NixOS 25.05, nixos-generators is deprecated because its functionality has been upstreamed into nixpkgs. The primary replacement for the nixos-generate command is the new nixos-rebuild build-image command. Users should migrate to using nixos-rebuild for building system images.
  4. Reference: Supported image variants for nixos-rebuild build-image

    master
    The following table lists the image formats previously provided by nixos-generators and their status/equivalent in the new nixos-rebuild build-image command. Use the --image-variant flag with these names to specify the output format.