From 591e8d5708b5c245d4349479828f4c05a45979e8 Mon Sep 17 00:00:00 2001 From: worldofpeace Date: Fri, 27 Mar 2020 21:09:07 -0400 Subject: [PATCH] iso-image: make sure volumeID is less than 32 chars --- nixos/modules/installer/cd-dvd/iso-image.nix | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/nixos/modules/installer/cd-dvd/iso-image.nix b/nixos/modules/installer/cd-dvd/iso-image.nix index 58589b6b824779..b85f20bb09bc37 100644 --- a/nixos/modules/installer/cd-dvd/iso-image.nix +++ b/nixos/modules/installer/cd-dvd/iso-image.nix @@ -524,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;