Building a bootable ISO image


Building a bootable ISO image


If you need to build images for a different platform, see Cross compiling.

You may find that an official installation image lacks some hardware support.

The solution is to create myimage.nix to point to the latest kernel using the minimal installation ISO:

{ pkgs, modulesPath, lib, ... }: {
  imports = [

  # use the latest Linux kernel
  boot.kernelPackages = pkgs.linuxPackages_latest;

  # Needed for
  boot.supportedFilesystems = lib.mkForce [ "btrfs" "reiserfs" "vfat" "f2fs" "xfs" "ntfs" "cifs" ];

Generate an ISO with the above configuration:

$ NIX_PATH=nixpkgs= nix-shell -p nixos-generators --run "nixos-generate --format iso --configuration ./myimage.nix -o result"

Copy the new image to your USB stick by replacing sdX with the name of your device:

$ dd if=result/iso/*.iso of=/dev/sdX status=progress
$ sync

Next steps