{
  lib,
  config,
  pkgs,
  ...
}: let
  cfg = config.boot.loader.limine;
in {
  options.boot.loader.limine.bootMode = lib.mkOption {
    type = lib.types.enum ["bios" "uefi"];
    default = "uefi";
    description = "Boot mode: BIOS (MBR) or UEFI";
  };

  config.boot.loader = {
    limine = {
      enable = true;
      efiSupport = cfg.bootMode == "uefi";
      biosSupport = cfg.bootMode == "bios";
      biosDevice = lib.mkIf (cfg.bootMode == "bios") (lib.mkDefault "/dev/nvme1n1");
      maxGenerations = 10;
      style.wallpapers = [
        pkgs.nixos-artwork.wallpapers.simple-dark-gray-bootloader.gnomeFilePath
      ];
    };
    grub.enable = lib.mkForce false;
    systemd-boot.enable = lib.mkForce false;
  };
}
