Files
nixos/modules/hardware/bootmode.nix
2025-08-30 20:31:10 +02:00

29 lines
614 B
Nix

{ config, lib, ... }:
let
inherit (lib) mkOption types;
in
{
options.bootMode = mkOption {
type = types.enum [ "uefi" "legacy" ];
default = "uefi";
description = "Select boot mode: 'uefi' or 'legacy'.";
};
config = {
boot.consoleLogLevel = 0;
boot.kernelParams = [ "quiet" "udev.log_level=3" ];
boot.loader = if config.bootMode == "uefi" then {
efi.canTouchEfiVariables = true;
systemd-boot.enable = true;
timeout = 0;
} else {
grub.enable = true;
grub.device = "/dev/sda"; # <- replace with actual target disk
timeout = 0;
};
};
}