From 50063bf9d62f782757bf33a83fec40db593841d6 Mon Sep 17 00:00:00 2001 From: Samuel Dionne-Riel Date: Mon, 6 Mar 2023 23:59:39 -0500 Subject: nixos/grub: Add support for timeoutStyle --- nixos/modules/system/boot/loader/grub/grub.nix | 26 +++++++++++++++++++++- .../system/boot/loader/grub/install-grub.pl | 2 ++ 2 files changed, 27 insertions(+), 1 deletion(-) (limited to 'nixos/modules/system') diff --git a/nixos/modules/system/boot/loader/grub/grub.nix b/nixos/modules/system/boot/loader/grub/grub.nix index e0171a71da938..120e7f3315347 100644 --- a/nixos/modules/system/boot/loader/grub/grub.nix +++ b/nixos/modules/system/boot/loader/grub/grub.nix @@ -63,7 +63,9 @@ let extraGrubInstallArgs extraEntriesBeforeNixOS extraPrepareConfig configurationLimit copyKernels default fsIdentifier efiSupport efiInstallAsRemovable gfxmodeEfi gfxmodeBios gfxpayloadEfi gfxpayloadBios - users; + users + timeoutStyle + ; path = with pkgs; makeBinPath ( [ coreutils gnused gnugrep findutils diffutils btrfs-progs util-linux mdadm ] ++ optional cfg.efiSupport efibootmgr @@ -425,6 +427,28 @@ in ''; }; + timeoutStyle = mkOption { + default = "menu"; + type = types.enum [ "menu" "countdown" "hidden" ]; + description = lib.mdDoc '' + - `menu` shows the menu. + - `countdown` uses a text-mode countdown. + - `hidden` hides GRUB entirely. + + When using a theme, the default value (`menu`) is appropriate for the graphical countdown. + + When attempting to do flicker-free boot, `hidden` should be used. + + See the [GRUB documentation section about `timeout_style`](https://www.gnu.org/software/grub/manual/grub/html_node/timeout.html). + + ::: {.note} + If this option is set to ‘countdown’ or ‘hidden’ [...] and ESC or F4 are pressed, or SHIFT is held down during that time, it will display the menu and wait for input. + ::: + + From: [Simple configuration handling page, under GRUB_TIMEOUT_STYLE](https://www.gnu.org/software/grub/manual/grub/html_node/Simple-configuration.html). + ''; + }; + entryOptions = mkOption { default = "--class nixos --unrestricted"; type = types.nullOr types.str; diff --git a/nixos/modules/system/boot/loader/grub/install-grub.pl b/nixos/modules/system/boot/loader/grub/install-grub.pl index f301d838f663f..93ad3f1ed706a 100644 --- a/nixos/modules/system/boot/loader/grub/install-grub.pl +++ b/nixos/modules/system/boot/loader/grub/install-grub.pl @@ -75,6 +75,7 @@ my $backgroundColor = get("backgroundColor"); my $configurationLimit = int(get("configurationLimit")); my $copyKernels = get("copyKernels") eq "true"; my $timeout = int(get("timeout")); +my $timeoutStyle = get("timeoutStyle"); my $defaultEntry = get("default"); my $fsIdentifier = get("fsIdentifier"); my $grubEfi = get("grubEfi"); @@ -319,6 +320,7 @@ $conf .= " set default=$defaultEntryText set timeout=$timeout fi + set timeout_style=$timeoutStyle function savedefault { if [ -z \"\${boot_once}\"]; then -- cgit 1.4.1