Building bootable ISO image


In case you’d like to build images for a different platform that you’re on, see Cross compiling.

Often we’re faced with the official installation image lacking some hardware support.

Create myimage.nix that will point the kernel to the latest 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-shell -p nixos-generators -I nixpkgs= --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