Skip to content

Commit

Permalink
make-disk-image: allow vmTools qemu usage to be overriden by disko co…
Browse files Browse the repository at this point in the history
…nfiguration

This is needed to prevent two layers of emulation when offering a build for a host running binfmt such as an x86 host trying to compile for aarch64 via binfmt
  • Loading branch information
MatthewCroughan committed Aug 14, 2024
1 parent de015d2 commit d8a1d5e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions lib/make-disk-image.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
let
vmTools = pkgs.vmTools.override {
rootModules = [ "9p" "9pnet_virtio" "virtio_pci" "virtio_blk" ] ++ nixosConfig.config.disko.extraRootModules;
customQemu = nixosConfig.config.disko.imageBuilderQemu;
kernel = pkgs.aggregateModules
(with nixosConfig.config.disko.imageBuilderKernelPackages; [ kernel ]
++ lib.optional (lib.elem "zfs" nixosConfig.config.disko.extraRootModules) zfs);
Expand Down
12 changes: 10 additions & 2 deletions module.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,16 @@ let
in
{
options.disko = {
imageBuilderKernel = lib.mkOption {
type = lib.types.package;
imageBuilderQemu = lib.mkOption {
type = lib.types.nullOr lib.types.str;
description = ''
the qemu emulator string used when building disk images via make-disk-image.nix.
Useful when using binfmt on your build host, and wanting to build disk
images for a foreign architecture
'';
default = null;
example = lib.literalExpression "''${pkgs.qemu_kvm}/bin/qemu-system-aarch64";
};
imageBuilderPkgs = lib.mkOption {
type = lib.types.attrs;
description = ''
Expand Down

0 comments on commit d8a1d5e

Please sign in to comment.