Merge pull request #223610 from ners/master

nixos/iso-image: prepend to ISO menu labels
This commit is contained in:
Ryan Lahfa
2023-05-22 14:07:53 +02:00
committed by GitHub
+30 -7
View File
@@ -52,7 +52,7 @@ let
buildMenuAdditionalParamsGrub2 = additional:
let
finalCfg = {
name = "${config.system.nixos.distroName} ${config.system.nixos.label}${config.isoImage.appendToMenuLabel}";
name = "${config.isoImage.prependToMenuLabel}${config.system.nixos.distroName} ${config.system.nixos.label}${config.isoImage.appendToMenuLabel}";
params = "init=${config.system.build.toplevel}/init ${additional} ${toString config.boot.kernelParams}";
image = "/boot/${config.system.boot.loader.kernelFile}";
initrd = "/boot/initrd";
@@ -109,35 +109,35 @@ let
DEFAULT boot
LABEL boot
MENU LABEL ${config.system.nixos.distroName} ${config.system.nixos.label}${config.isoImage.appendToMenuLabel}
MENU LABEL ${config.isoImage.prependToMenuLabel}${config.system.nixos.distroName} ${config.system.nixos.label}${config.isoImage.appendToMenuLabel}
LINUX /boot/${config.system.boot.loader.kernelFile}
APPEND init=${config.system.build.toplevel}/init ${toString config.boot.kernelParams}
INITRD /boot/${config.system.boot.loader.initrdFile}
# A variant to boot with 'nomodeset'
LABEL boot-nomodeset
MENU LABEL ${config.system.nixos.distroName} ${config.system.nixos.label}${config.isoImage.appendToMenuLabel} (nomodeset)
MENU LABEL ${config.isoImage.prependToMenuLabel}${config.system.nixos.distroName} ${config.system.nixos.label}${config.isoImage.appendToMenuLabel} (nomodeset)
LINUX /boot/${config.system.boot.loader.kernelFile}
APPEND init=${config.system.build.toplevel}/init ${toString config.boot.kernelParams} nomodeset
INITRD /boot/${config.system.boot.loader.initrdFile}
# A variant to boot with 'copytoram'
LABEL boot-copytoram
MENU LABEL ${config.system.nixos.distroName} ${config.system.nixos.label}${config.isoImage.appendToMenuLabel} (copytoram)
MENU LABEL ${config.isoImage.prependToMenuLabel}${config.system.nixos.distroName} ${config.system.nixos.label}${config.isoImage.appendToMenuLabel} (copytoram)
LINUX /boot/${config.system.boot.loader.kernelFile}
APPEND init=${config.system.build.toplevel}/init ${toString config.boot.kernelParams} copytoram
INITRD /boot/${config.system.boot.loader.initrdFile}
# A variant to boot with verbose logging to the console
LABEL boot-debug
MENU LABEL ${config.system.nixos.distroName} ${config.system.nixos.label}${config.isoImage.appendToMenuLabel} (debug)
MENU LABEL ${config.isoImage.prependToMenuLabel}${config.system.nixos.distroName} ${config.system.nixos.label}${config.isoImage.appendToMenuLabel} (debug)
LINUX /boot/${config.system.boot.loader.kernelFile}
APPEND init=${config.system.build.toplevel}/init ${toString config.boot.kernelParams} loglevel=7
INITRD /boot/${config.system.boot.loader.initrdFile}
# A variant to boot with a serial console enabled
LABEL boot-serial
MENU LABEL ${config.system.nixos.distroName} ${config.system.nixos.label}${config.isoImage.appendToMenuLabel} (serial console=ttyS0,115200n8)
MENU LABEL ${config.isoImage.prependToMenuLabel}${config.system.nixos.distroName} ${config.system.nixos.label}${config.isoImage.appendToMenuLabel} (serial console=ttyS0,115200n8)
LINUX /boot/${config.system.boot.loader.kernelFile}
APPEND init=${config.system.build.toplevel}/init ${toString config.boot.kernelParams} console=ttyS0,115200n8
INITRD /boot/${config.system.boot.loader.initrdFile}
@@ -452,6 +452,7 @@ in
isoImage.isoName = mkOption {
default = "${config.isoImage.isoBaseName}.iso";
type = lib.types.str;
description = lib.mdDoc ''
Name of the generated ISO image file.
'';
@@ -459,6 +460,7 @@ in
isoImage.isoBaseName = mkOption {
default = config.system.nixos.distroId;
type = lib.types.str;
description = lib.mdDoc ''
Prefix of the name of the generated ISO image file.
'';
@@ -466,6 +468,7 @@ in
isoImage.compressImage = mkOption {
default = false;
type = lib.types.bool;
description = lib.mdDoc ''
Whether the ISO image should be compressed using
{command}`zstd`.
@@ -479,15 +482,16 @@ in
+ lib.optionalString isAarch "-Xbcj arm"
+ lib.optionalString (isPower && is32bit && isBigEndian) "-Xbcj powerpc"
+ lib.optionalString (isSparc) "-Xbcj sparc";
type = lib.types.str;
description = lib.mdDoc ''
Compression settings to use for the squashfs nix store.
'';
example = "zstd -Xcompression-level 6";
type = types.str;
};
isoImage.edition = mkOption {
default = "";
type = lib.types.str;
description = lib.mdDoc ''
Specifies which edition string to use in the volume ID of the generated
ISO image.
@@ -497,6 +501,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.uname.processor}";
type = lib.types.str;
description = lib.mdDoc ''
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
@@ -527,6 +532,7 @@ in
isoImage.includeSystemBuildDependencies = mkOption {
default = false;
type = lib.types.bool;
description = lib.mdDoc ''
Set this option to include all the needed sources etc in the
image. It significantly increases image size. Use that when
@@ -538,6 +544,7 @@ in
isoImage.makeBiosBootable = mkOption {
default = false;
type = lib.types.bool;
description = lib.mdDoc ''
Whether the ISO image should be a BIOS-bootable disk.
'';
@@ -545,6 +552,7 @@ in
isoImage.makeEfiBootable = mkOption {
default = false;
type = lib.types.bool;
description = lib.mdDoc ''
Whether the ISO image should be an EFI-bootable volume.
'';
@@ -552,6 +560,7 @@ in
isoImage.makeUsbBootable = mkOption {
default = false;
type = lib.types.bool;
description = lib.mdDoc ''
Whether the ISO image should be bootable from CD as well as USB.
'';
@@ -616,8 +625,22 @@ in
'';
};
isoImage.prependToMenuLabel = mkOption {
default = "";
type = types.str;
example = "Install ";
description = lib.mdDoc ''
The string to prepend before the menu label for the NixOS system.
This will be directly prepended (without whitespace) to the NixOS version
string, like for example if it is set to `XXX`:
`XXXNixOS 99.99-pre666`
'';
};
isoImage.appendToMenuLabel = mkOption {
default = " Installer";
type = types.str;
example = " Live System";
description = lib.mdDoc ''
The string to append after the menu label for the NixOS system.