626a666da5
The gummiboot-builder.py script is expecting the @timeout@ metavar to be substituted for either an empty string (in the case where a user has left the timeout unset) or the actual value set in the system configuration. However, the config.boot.loader.gummiboot.timeout option defaults to 'null', and due to the way pkgs.substituteAll works, the substitution for '@timeout@' is _never_ set to the empty string. This causes the builder script to put a bogus line into /boot/loader/loader.conf: timeout @timeout@ Fix this by explicitly setting 'timeout' to the empty string when it's unset in the system configuration. Signed-off-by: Josh Cartwright <joshc@eso.teric.us>
69 lines
1.4 KiB
Nix
69 lines
1.4 KiB
Nix
{ config, lib, pkgs, ... }:
|
|
|
|
with lib;
|
|
|
|
let
|
|
cfg = config.boot.loader.gummiboot;
|
|
|
|
efi = config.boot.loader.efi;
|
|
|
|
gummibootBuilder = pkgs.substituteAll {
|
|
src = ./gummiboot-builder.py;
|
|
|
|
isExecutable = true;
|
|
|
|
inherit (pkgs) python gummiboot;
|
|
|
|
nix = config.nix.package;
|
|
|
|
timeout = if cfg.timeout != null then cfg.timeout else "";
|
|
|
|
inherit (efi) efiSysMountPoint canTouchEfiVariables;
|
|
};
|
|
in {
|
|
options.boot.loader.gummiboot = {
|
|
enable = mkOption {
|
|
default = false;
|
|
|
|
type = types.bool;
|
|
|
|
description = "Whether to enable the gummiboot UEFI boot manager";
|
|
};
|
|
|
|
timeout = mkOption {
|
|
default = null;
|
|
|
|
example = 4;
|
|
|
|
type = types.nullOr types.int;
|
|
|
|
description = ''
|
|
Timeout (in seconds) for how long to show the menu (null if none).
|
|
Note that even with no timeout the menu can be forced if the space
|
|
key is pressed during bootup
|
|
'';
|
|
};
|
|
};
|
|
|
|
config = mkIf cfg.enable {
|
|
assertions = [
|
|
{
|
|
assertion = (config.boot.kernelPackages.kernel.features or { efiBootStub = true; }) ? efiBootStub;
|
|
|
|
message = "This kernel does not support the EFI boot stub";
|
|
}
|
|
];
|
|
|
|
boot.loader.grub.enable = mkDefault false;
|
|
|
|
system = {
|
|
build.installBootLoader = gummibootBuilder;
|
|
|
|
boot.loader.id = "gummiboot";
|
|
|
|
requiredKernelConfig = with config.lib.kernelConfig; [
|
|
(isYes "EFI_STUB")
|
|
];
|
|
};
|
|
};
|
|
}
|