Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[20.03] iso-image: normalize volumeID #84863

Merged
merged 4 commits into from
Apr 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions nixos/lib/make-iso9660-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ xorriso="xorriso
-publisher nixos
-graft-points
-full-iso9660-filenames
-joliet
${isoBootFlags}
${usbBootFlags}
${efiBootFlags}
Expand Down
2 changes: 0 additions & 2 deletions nixos/modules/installer/cd-dvd/installation-cd-base.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ with lib;
{
imports = [ ./installation-cd-graphical-base.nix ];

isoImage.edition = "gnome";

services.xserver.desktopManager.gnome3.enable = true;

# Auto-login as root.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ with lib;
{
imports = [ ./installation-cd-graphical-base.nix ];

isoImage.edition = "plasma5";

services.xserver = {
desktopManager.plasma5 = {
enable = true;
Expand Down
2 changes: 2 additions & 0 deletions nixos/modules/installer/cd-dvd/installation-cd-minimal.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@
[ ./installation-cd-base.nix
];

isoImage.edition = "minimal";

fonts.fontconfig.enable = false;
}
24 changes: 23 additions & 1 deletion nixos/modules/installer/cd-dvd/iso-image.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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.uname.processor}";
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
Expand Down Expand Up @@ -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;

Expand Down