From 663f1d8ba2753ce68fcf7f9ef8198b4c35d13558 Mon Sep 17 00:00:00 2001 From: superherointj <5861043+superherointj@users.noreply.github.com> Date: Thu, 3 Apr 2025 16:39:42 -0300 Subject: [PATCH] nixos/modules/installer/sd-card: allow to customize volume label --- nixos/modules/installer/sd-card/sd-image.nix | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/nixos/modules/installer/sd-card/sd-image.nix b/nixos/modules/installer/sd-card/sd-image.nix index 988ab9ee003f..7a2e271c4dde 100644 --- a/nixos/modules/installer/sd-card/sd-image.nix +++ b/nixos/modules/installer/sd-card/sd-image.nix @@ -26,7 +26,7 @@ let 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; @@ -117,6 +117,17 @@ in ''; }; + 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 @@ -197,7 +208,7 @@ in ]; }; "/" = { - device = "/dev/disk/by-label/NIXOS_SD"; + device = "/dev/disk/by-label/${config.sdImage.rootVolumeLabel}"; fsType = "ext4"; }; };