nixos/installer: add new options to customize sd-card image creation (#450774)
This commit is contained in:
@@ -21,7 +21,7 @@
|
||||
with lib;
|
||||
|
||||
let
|
||||
rootfsImage = pkgs.callPackage ../../../lib/make-ext4-fs.nix (
|
||||
rootfsImage = pkgs.callPackage config.sdImage.rootFilesystemCreator (
|
||||
{
|
||||
inherit (config.sdImage) storePaths;
|
||||
compressImage = config.sdImage.compressImage;
|
||||
@@ -128,6 +128,29 @@ in
|
||||
'';
|
||||
};
|
||||
|
||||
rootFilesystemCreator = mkOption {
|
||||
type = types.oneOf [
|
||||
types.package
|
||||
types.path
|
||||
];
|
||||
default = ../../../lib/make-ext4-fs.nix;
|
||||
example = ''
|
||||
nixpkgs/nixos/lib/make-btrfs-fs.nix
|
||||
'';
|
||||
description = ''
|
||||
The filesystem creator used for the root partition.
|
||||
'';
|
||||
};
|
||||
|
||||
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
|
||||
@@ -254,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
|
||||
|
||||
Reference in New Issue
Block a user