Merge pull request #83551 from worldofpeace/iso-id

iso-image: normalize volumeID
This commit is contained in:
worldofpeace 2020-04-09 19:31:52 -04:00 committed by GitHub
commit 8583d99e42
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 30 additions and 3 deletions

View file

@ -107,6 +107,7 @@ xorriso="xorriso
-publisher nixos
-graft-points
-full-iso9660-filenames
-joliet
${isoBootFlags}
${usbBootFlags}
${efiBootFlags}

View file

@ -18,8 +18,6 @@ with lib;
# ISO naming.
isoImage.isoName = "${config.isoImage.isoBaseName}-${config.system.nixos.label}-${pkgs.stdenv.hostPlatform.system}.iso";
isoImage.volumeID = substring 0 11 "NIXOS_ISO";
# EFI booting
isoImage.makeEfiBootable = true;

View file

@ -7,6 +7,8 @@ with lib;
{
imports = [ ./installation-cd-graphical-base.nix ];
isoImage.edition = "gnome";
services.xserver.desktopManager.gnome3.enable = true;
# Wayland can be problematic for some hardware like Nvidia graphics cards.

View file

@ -8,6 +8,8 @@ with lib;
{
imports = [ ./installation-cd-graphical-base.nix ];
isoImage.edition = "plasma5";
services.xserver = {
desktopManager.plasma5 = {
enable = true;

View file

@ -8,5 +8,7 @@
[ ./installation-cd-base.nix
];
isoImage.edition = "minimal";
fonts.fontconfig.enable = false;
}

View file

@ -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;