{ config, lib, ... }: with lib; { options.smayzy.grub.disable = mkOption { type = types.bool; default = false; description = "if don't need a cool bootloader"; }; options.smayzy.grub-on-lap.enable = mkOption { type = types.bool; default = false; description = "make grub works on this piece of shit laptop that can't boot normally"; }; config = lib.mkMerge [ (lib.mkIf (!config.smayzy.grub.disable) { boot.loader.systemd-boot.enable = false; boot.loader.grub.enable = true; boot.loader.grub.efiSupport = true; boot.loader.grub.device = "nodev"; boot.loader.grub.efiInstallAsRemovable = config.smayzy.grub-on-lap.enable; boot.loader.efi.canTouchEfiVariables = !config.smayzy.grub-on-lap.enable; }) (lib.mkIf config.smayzy.grub.disable { boot.loader.systemd-boot.enable = true; }) ]; }