{
  lib,
  config,
  pkgs,
  ...
}: let
  cfg = config.hive.hyprland;
in {
  options.hive.hyprland = {
    enable = lib.mkEnableOption "enable hyprland desktop environment";
  };
  config = lib.mkIf cfg.enable {
    services = {
      libinput.enable = true;
      dbus.enable = true;
    };

    xdg.portal = {
      enable = true;
      extraPortals = with pkgs; [
        xdg-desktop-portal-wlr
        xdg-desktop-portal-hyprland
        kdePackages.xdg-desktop-portal-kde
      ];
    };

    environment.systemPackages = with pkgs; [spaceFM];

    services.udisks2.enable = true;

    programs.hyprland = {
      enable = true;
      withUWSM = true;
      xwayland.enable = true;
    };
    programs.hyprlock.enable = true;
    security.pam.services.hyprlock = {};
  };
}
