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.
This commit is contained in:
Bloxx12 2025-04-09 15:31:18 +02:00
commit a5f955ff08

View file

@ -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;