diff --git a/flake.nix b/flake.nix index af70319..0e2dcfe 100755 --- a/flake.nix +++ b/flake.nix @@ -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"; } ]; diff --git a/nixos/boot/boot.nix b/nixos/boot/boot.nix index 8614cce..1ddafe6 100755 --- a/nixos/boot/boot.nix +++ b/nixos/boot/boot.nix @@ -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; + }; + }; } diff --git a/nixos/presets/core/boot/no-bootloader-menu.nix b/nixos/presets/core/boot/no-bootloader-menu.nix deleted file mode 100644 index ce3baa9..0000000 --- a/nixos/presets/core/boot/no-bootloader-menu.nix +++ /dev/null @@ -1,3 +0,0 @@ -{...}: { - boot.loader.timeout = 0; -}