nixos: add myFlake.nixos.boot.{silentboot,noLoaderMenu}

This commit is contained in:
Guanran Wang 2023-11-09 11:55:14 +08:00
parent f7287b37fe
commit 65a8502ecb
Signed by: nyancat
SSH key fingerprint: SHA256:8oWGKciPALWut/6WA27oFKofX+6Wtc0gQnsefXLQx/8
3 changed files with 46 additions and 15 deletions

View file

@ -170,7 +170,6 @@
# OS
./nixos/presets/desktop.nix
./nixos/presets/core/zram-generator.nix
./nixos/presets/core/boot/no-bootloader-menu.nix
./nixos/presets/desktop/gaming.nix
./nixos/presets/desktop/virtualbox.nix
./nixos/presets/desktop/wayland.nix
@ -195,6 +194,7 @@
];
### Options
myFlake.nixos.boot.noLoaderMenu = true;
myFlake.nixos.networking.dns = "alidns";
}
];

View file

@ -1,15 +1,49 @@
{lib, ...}: {
boot = {
consoleLogLevel = lib.mkDefault 3;
loader = {
efi.canTouchEfiVariables = true;
systemd-boot = {
enable = lib.mkDefault true; # mkDefault for Lanzaboote
editor = false; # Disabled for security
### Utilities
#netbootxyz.enable = true;
#memtest86.enable = true;
{
config,
lib,
...
}: {
options = {
myFlake.nixos = {
boot = {
silentBoot = lib.mkOption {
type = lib.types.bool;
default = false;
example = true;
description = "Enable silent boot";
};
noLoaderMenu = lib.mkOption {
type = lib.types.bool;
default = false;
example = true;
description = "Disable bootloader menu";
};
};
};
};
### myFlake.nixos.boot.noLoaderMenu
config.boot.loader.timeout = lib.mkIf config.myFlake.nixos.boot.noLoaderMenu 0;
### myFlake.nixos.boot.silentBoot
config.boot.consoleLogLevel = lib.mkIf config.myFlake.nixos.boot.silentBoot 0;
config.boot.kernelParams =
lib.mkIf config.myFlake.nixos.boot.silentBoot
(["quiet"]
++ lib.optionals config.boot.initrd.systemd.enable [
"systemd.show_status=auto"
"rd.udev.log_level=3"
]);
### Misc
config.boot.loader = {
efi.canTouchEfiVariables = true;
systemd-boot = {
enable = lib.mkDefault true; # mkDefault for Lanzaboote
editor = false; # Disabled for security
### Utilities
#netbootxyz.enable = true;
#memtest86.enable = true;
};
};
}

View file

@ -1,3 +0,0 @@
{...}: {
boot.loader.timeout = 0;
}