{ config, lib, ... }:
let
  cfg = config.khscodes.systemd-boot;
in
{
  options.khscodes.systemd-boot = {
    enable = lib.mkEnableOption "Enables booting using systemd";
    configuration-limit = lib.mkOption {
      type = lib.types.int;
      description = "";
      default = 5;
    };
  };

  config = lib.mkIf cfg.enable {
    boot = {
      loader = {
        systemd-boot = {
          enable = true;
          configurationLimit = cfg.configuration-limit;
        };
        grub = {
          enable = false;
        };
        efi = {
          canTouchEfiVariables = true;
          efiSysMountPoint = "/boot";
        };
      };
    };
  };
}
