From a775961c8f54c09f6a97c1091d4198605c4baf85 Mon Sep 17 00:00:00 2001 From: worldofpeace Date: Thu, 9 Apr 2020 20:06:32 -0400 Subject: [PATCH 1/2] Revert "Revert "iso-image: normalize volumeID"" This reverts commit 21b50e6f6879f22b9261362bfd6dce26b7611e18. --- nixos/lib/make-iso9660-image.sh | 1 + .../installer/cd-dvd/installation-cd-base.nix | 2 -- .../installation-cd-graphical-gnome.nix | 2 ++ .../installation-cd-graphical-plasma5.nix | 2 ++ .../cd-dvd/installation-cd-minimal.nix | 2 ++ nixos/modules/installer/cd-dvd/iso-image.nix | 24 ++++++++++++++++++- 6 files changed, 30 insertions(+), 3 deletions(-) diff --git a/nixos/lib/make-iso9660-image.sh b/nixos/lib/make-iso9660-image.sh index b7b1ab52a637..d4633d2c8d16 100644 --- a/nixos/lib/make-iso9660-image.sh +++ b/nixos/lib/make-iso9660-image.sh @@ -107,6 +107,7 @@ xorriso="xorriso -publisher nixos -graft-points -full-iso9660-filenames + -joliet ${isoBootFlags} ${usbBootFlags} ${efiBootFlags} diff --git a/nixos/modules/installer/cd-dvd/installation-cd-base.nix b/nixos/modules/installer/cd-dvd/installation-cd-base.nix index 24070a786945..9303e8fde13a 100644 --- a/nixos/modules/installer/cd-dvd/installation-cd-base.nix +++ b/nixos/modules/installer/cd-dvd/installation-cd-base.nix @@ -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; diff --git a/nixos/modules/installer/cd-dvd/installation-cd-graphical-gnome.nix b/nixos/modules/installer/cd-dvd/installation-cd-graphical-gnome.nix index 62cbdbcfd17b..84394a1ecae5 100644 --- a/nixos/modules/installer/cd-dvd/installation-cd-graphical-gnome.nix +++ b/nixos/modules/installer/cd-dvd/installation-cd-graphical-gnome.nix @@ -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. diff --git a/nixos/modules/installer/cd-dvd/installation-cd-graphical-plasma5.nix b/nixos/modules/installer/cd-dvd/installation-cd-graphical-plasma5.nix index e00d3f7535b2..e76e06654aca 100644 --- a/nixos/modules/installer/cd-dvd/installation-cd-graphical-plasma5.nix +++ b/nixos/modules/installer/cd-dvd/installation-cd-graphical-plasma5.nix @@ -8,6 +8,8 @@ with lib; { imports = [ ./installation-cd-graphical-base.nix ]; + isoImage.edition = "plasma5"; + services.xserver = { desktopManager.plasma5 = { enable = true; diff --git a/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix b/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix index bcdbffdc20b7..97506045e0e1 100644 --- a/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix +++ b/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix @@ -8,5 +8,7 @@ [ ./installation-cd-base.nix ]; + isoImage.edition = "minimal"; + fonts.fontconfig.enable = false; } diff --git a/nixos/modules/installer/cd-dvd/iso-image.nix b/nixos/modules/installer/cd-dvd/iso-image.nix index 4558b4dc9552..b85f20bb09bc 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; From df8c30fa25637f7ae6fe427dc6d55536707a5e92 Mon Sep 17 00:00:00 2001 From: worldofpeace Date: Thu, 9 Apr 2020 20:10:01 -0400 Subject: [PATCH 2/2] iso-image: make $ARCH shorter we use stdenv.hostPlatform.uname.processor, which I believe is just like `uname -p`. Example values: ``` (import { system = "x86_64-linux"; }).stdenv.hostPlatform.uname.processor "x86_64" (import { system = "aarch64-linux"; }).stdenv.hostPlatform.uname.processor aarch64 (import { system = "armv7l-linux"; }).stdenv.hostPlatform.uname.processor "armv7l" ``` --- nixos/modules/installer/cd-dvd/iso-image.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/modules/installer/cd-dvd/iso-image.nix b/nixos/modules/installer/cd-dvd/iso-image.nix index b85f20bb09bc..5243a8aa747b 100644 --- a/nixos/modules/installer/cd-dvd/iso-image.nix +++ b/nixos/modules/installer/cd-dvd/iso-image.nix @@ -427,7 +427,7 @@ in isoImage.volumeID = mkOption { # nixos-$EDITION-$RELEASE-$ARCH - default = "nixos${optionalString (config.isoImage.edition != "") "-${config.isoImage.edition}"}-${config.system.nixos.release}-${pkgs.stdenv.hostPlatform.system}"; + 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