From f5ae72b1c1049ab6e112b78a04e4b198201745c4 Mon Sep 17 00:00:00 2001 From: "Jan B." Date: Fri, 12 Sep 2025 14:01:46 +0200 Subject: [PATCH] nixos/installer: add option to override the root filesystem image creator itself allows overriding the process how the filesystem image is created which the resulting sd-card image will use. --- nixos/modules/installer/sd-card/sd-image.nix | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/nixos/modules/installer/sd-card/sd-image.nix b/nixos/modules/installer/sd-card/sd-image.nix index c43f1642cdec..b3251f9c6e1d 100644 --- a/nixos/modules/installer/sd-card/sd-image.nix +++ b/nixos/modules/installer/sd-card/sd-image.nix @@ -142,6 +142,15 @@ in ''; }; + rootFilesystemImage = mkOption { + type = types.package; + default = rootfsImage; + description = '' + The finished root partition image with all custom fileystem modifications. + Used to override the filesystem creator itself. + ''; + }; + firmwareSize = mkOption { type = types.int; # As of 2019-08-18 the Raspberry pi firmware + u-boot takes ~18MiB @@ -268,11 +277,11 @@ in echo "file sd-image $img" >> $out/nix-support/hydra-build-products fi - root_fs=${rootfsImage} + root_fs=${config.sdImage.rootFilesystemImage} ${lib.optionalString config.sdImage.compressImage '' root_fs=./root-fs.img echo "Decompressing rootfs image" - zstd -d --no-progress "${rootfsImage}" -o $root_fs + zstd -d --no-progress "${config.sdImage.rootFilesystemImage}" -o $root_fs ''} # Gap in front of the first partition, in MiB