make-disk-image: add binfmt emulation

This commit is contained in:
Sávio authored and Jörg Thalheim committed 2025-02-14 10:39:29 +00:00
1 parent 85942f35d3
commit 6438340415
4 files changed
+191 -1

No files matched your search

+8 -1
View File
@@ -3,6 +3,7 @@
, lib
, extendModules
, options
, imagePkgs
, ...
}:
let
@@ -12,6 +13,12 @@ let
checked = diskoCfg.checkScripts;
configSupportsZfs = config.boot.supportedFilesystems.zfs or false;
binfmt = diskoLib.binfmt { inherit diskoLib lib pkgs imagePkgs; };
binfmtSetup = lib.optionalString (cfg.enableBinfmt && binfmt.systemsAreDifferent) ''
mount binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc
${pkgs.systemdMinimal}/lib/systemd/systemd-binfmt <(echo ${lib.strings.escapeShellArg binfmt.binfmtRegistration})
'';
vmTools = pkgs.vmTools.override
({
rootModules = [
@@ -124,7 +131,7 @@ in
postVM = cfg.extraPostVM;
inherit (diskoCfg) memSize;
}
(partitioner + installer));
(binfmtSetup + partitioner + installer));
system.build.diskoImagesScript = diskoLib.writeCheckedBash { inherit checked pkgs; } cfg.name ''
set -efu