nixos/modules/installer/sd-card: allow to customize volume label

Changed files
+13 -2
nixos
modules
installer
sd-card
+13 -2
nixos/modules/installer/sd-card/sd-image.nix
···
inherit (config.sdImage) storePaths;
compressImage = config.sdImage.compressImage;
populateImageCommands = config.sdImage.populateRootCommands;
-
volumeLabel = "NIXOS_SD";
+
volumeLabel = config.sdImage.rootVolumeLabel;
}
// optionalAttrs (config.sdImage.rootPartitionUUID != null) {
uuid = config.sdImage.rootPartitionUUID;
···
'';
};
+
rootVolumeLabel = mkOption {
+
type = types.str;
+
default = "NIXOS_SD";
+
example = "NIXOS_PENDRIVE";
+
description = ''
+
Label for the NixOS root volume.
+
Usually used when creating a recovery NixOS media installation
+
that avoids conflicting with previous instalation label.
+
'';
+
};
+
firmwareSize = mkOption {
type = types.int;
# As of 2019-08-18 the Raspberry pi firmware + u-boot takes ~18MiB
···
];
};
"/" = {
-
device = "/dev/disk/by-label/NIXOS_SD";
+
device = "/dev/disk/by-label/${config.sdImage.rootVolumeLabel}";
fsType = "ext4";
};
};