From 8a20efbb00b096d7d30211cd306cc360c8eba38c Mon Sep 17 00:00:00 2001
From: Mihai Fufezan <mihai@fufexan.net>
Date: Sun, 9 Jun 2024 14:11:01 +0300
Subject: [PATCH] hyprland: install xwayland if enabled

Install the `xwayland` package if `cfg.xwayland.enable = true;`.
This allows XWayland to work without having to enable the NixOS Hyprland
option.
---
 modules/services/window-managers/hyprland.nix | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/modules/services/window-managers/hyprland.nix b/modules/services/window-managers/hyprland.nix
index 6b79248b..8fbdc6b7 100644
--- a/modules/services/window-managers/hyprland.nix
+++ b/modules/services/window-managers/hyprland.nix
@@ -206,7 +206,10 @@ in {
         "You have enabled hyprland.systemd.enable or listed plugins in hyprland.plugins but do not have any configuration in hyprland.settings or hyprland.extraConfig. This is almost certainly a mistake.";
     in lib.optional inconsistent warning;
 
-    home.packages = lib.optional (cfg.package != null) cfg.finalPackage;
+    home.packages = lib.concatLists [
+      (lib.optional (cfg.package != null) cfg.finalPackage)
+      (lib.optional (cfg.xwayland.enable) pkgs.xwayland)
+    ];
 
     xdg.configFile."hypr/hyprland.conf" = let
       shouldGenerate = cfg.systemd.enable || cfg.extraConfig != ""