summary refs log tree commit diff
path: root/nixos/modules/installer/cd-dvd/iso-image.nix
diff options
context:
space:
mode:
authorworldofpeace <worldofpeace@protonmail.ch>2020-04-09 19:31:52 -0400
committerGitHub <noreply@github.com>2020-04-09 19:31:52 -0400
commit8583d99e429a99ded8c7e9433afc00cd37c27672 (patch)
tree17604a1ff3657d478521763e42081cc4bb658059 /nixos/modules/installer/cd-dvd/iso-image.nix
parentc751faddf3792e34f7cdedd302b4b33eb5782d69 (diff)
parent591e8d5708b5c245d4349479828f4c05a45979e8 (diff)
downloadnixpkgs-8583d99e429a99ded8c7e9433afc00cd37c27672.tar
nixpkgs-8583d99e429a99ded8c7e9433afc00cd37c27672.tar.gz
nixpkgs-8583d99e429a99ded8c7e9433afc00cd37c27672.tar.bz2
nixpkgs-8583d99e429a99ded8c7e9433afc00cd37c27672.tar.lz
nixpkgs-8583d99e429a99ded8c7e9433afc00cd37c27672.tar.xz
nixpkgs-8583d99e429a99ded8c7e9433afc00cd37c27672.tar.zst
nixpkgs-8583d99e429a99ded8c7e9433afc00cd37c27672.zip
Merge pull request #83551 from worldofpeace/iso-id
iso-image: normalize volumeID
Diffstat (limited to 'nixos/modules/installer/cd-dvd/iso-image.nix')
-rw-r--r--nixos/modules/installer/cd-dvd/iso-image.nix24
1 files changed, 23 insertions, 1 deletions
diff --git a/nixos/modules/installer/cd-dvd/iso-image.nix b/nixos/modules/installer/cd-dvd/iso-image.nix
index 4558b4dc955..b85f20bb09b 100644
--- a/nixos/modules/installer/cd-dvd/iso-image.nix
+++ b/nixos/modules/installer/cd-dvd/iso-image.nix
@@ -417,8 +417,17 @@ in
       '';
     };
 
+    isoImage.edition = mkOption {
+      default = "";
+      description = ''
+        Specifies which edition string to use in the volume ID of the generated
+        ISO image.
+      '';
+    };
+
     isoImage.volumeID = mkOption {
-      default = "NIXOS_BOOT_CD";
+      # nixos-$EDITION-$RELEASE-$ARCH
+      default = "nixos${optionalString (config.isoImage.edition != "") "-${config.isoImage.edition}"}-${config.system.nixos.release}-${pkgs.stdenv.hostPlatform.system}";
       description = ''
         Specifies the label or volume ID of the generated ISO image.
         Note that the label is used by stage 1 of the boot process to
@@ -515,6 +524,19 @@ in
   };
 
   config = {
+    assertions = [
+      {
+        assertion = !(stringLength config.isoImage.volumeID > 32);
+        # https://wiki.osdev.org/ISO_9660#The_Primary_Volume_Descriptor
+        # Volume Identifier can only be 32 bytes
+        message = let
+          length = stringLength config.isoImage.volumeID;
+          howmany = toString length;
+          toomany = toString (length - 32);
+        in
+        "isoImage.volumeID ${config.isoImage.volumeID} is ${howmany} characters. That is ${toomany} characters longer than the limit of 32.";
+      }
+    ];
 
     boot.loader.grub.version = 2;