From dc4687a53d8246a60349018684663afcd7485397 Mon Sep 17 00:00:00 2001 From: danjujan <44864658+danjujan@users.noreply.github.com> Date: Mon, 17 Feb 2025 14:14:24 +0700 Subject: [PATCH] docs: disko-images: add binfmt section --- docs/disko-images.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/docs/disko-images.md b/docs/disko-images.md index 51b2e86..433c307 100644 --- a/docs/disko-images.md +++ b/docs/disko-images.md @@ -104,6 +104,27 @@ In the this example we create a flake containing a nixos configuration for disko.devices.disk..imageSize = "32G"; # Set your preferred size ``` +- To build an image for another target platform, enable binfmt emulation support. + + ```console + disko.imageBuilder.enableBinfmt = true; + ``` + + This requires a working binfmt setup for your target platform on your build machine. Setup instructions are available for [NixOS](https://wiki.nixos.org/wiki/NixOS_on_ARM/Building_Images#Compiling_through_binfmt_QEMU) and other distros ([Arch Linux](https://wiki.archlinux.org/title/QEMU#Chrooting_into_arm/arm64_environment_from_x86_64), [Debian](https://wiki.debian.org/QemuUserEmulation)). + + The relevant configuration for building `aarch64-linux` images on a `x86_64-linux` host looks like this: + + ```console + disko = { + imageBuilder = { + enableBinfmt = true; + pkgs = inputs.nixpkgs.legacyPackages.x86_64-linux; + kernelPackages = inputs.nixpkgs.legacyPackages.x86_64-linux.linuxPackages_latest; + }; + + nixpkgs.hostPlatform = "aarch64-linux"; + ``` + ## Understanding the Image Generation Process 1. Files specified in `--pre-format-files` and `--post-format-files` are