From 60627d359429a62b0e86d15e9aac7176f7847ee8 Mon Sep 17 00:00:00 2001 From: Bloxx12 Date: Wed, 9 Apr 2025 15:31:18 +0200 Subject: [PATCH] boot/module.nix: add timeout option On desktop systems, it is convenient to have the timeout at zero, and just spam space when trying to start a previous generation. On servers however, it is preferable to have some time to choose the generation, which is quite convenient if you have to acess is remotely via a web interface, which tend to be quite slow and unresponsive. --- modules/system/boot/module.nix | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/modules/system/boot/module.nix b/modules/system/boot/module.nix index 275fa5d..bc3eeb1 100644 --- a/modules/system/boot/module.nix +++ b/modules/system/boot/module.nix @@ -5,13 +5,21 @@ ... }: let inherit (lib.modules) mkForce; - inherit (lib.options) mkEnableOption; + inherit (lib.options) mkOption mkEnableOption; + inherit (lib.types) int; cfg = config.modules.system.boot; in { options.modules.system.boot = { grub.enable = mkEnableOption "Grub, a bloated boot loader"; systemd-boot.enable = mkEnableOption "Poetteringboot"; + timeout = mkOption { + description = '' + Set the boot loader's timeout. This is 0 by default, but preferably longer on remote servers to make switching to previous generations easier. + ''; + type = int; + default = 0; + }; }; config = { assertions = [ @@ -33,7 +41,7 @@ in { loader = { efi.canTouchEfiVariables = true; # I love spamming space - timeout = 0; + timeout = cfg.timeout; systemd-boot = { enable = cfg.systemd-boot.enable; editor = mkForce false;