From 668902c9bad80237e83f758145266e62b11bf534 Mon Sep 17 00:00:00 2001
From: Zynh Ludwig <Zynh0722@gmail.com>
Date: Wed, 19 Mar 2025 06:28:45 -0700
Subject: [PATCH] hyprland: use mkMerge

---
 modules/hyprland.nix | 116 ++++++++++++-------------------------------
 1 file changed, 32 insertions(+), 84 deletions(-)

diff --git a/modules/hyprland.nix b/modules/hyprland.nix
index e81aa7b..d9ad5ce 100644
--- a/modules/hyprland.nix
+++ b/modules/hyprland.nix
@@ -8,35 +8,37 @@ in
     enable = lib.mkEnableOption "hyprland";
   };
 
-  config = lib.mkIf cfg.enable {
-    services.graphical-desktop.enable = lib.mkDefault true;
+  config = lib.mkIf cfg.enable (lib.mkMerge [
+    # Core Module
+    {
+      services.graphical-desktop.enable = lib.mkDefault true;
 
-    services.displayManager = {
-      enable = true;
-      # sessionPackages = [ pkgs.hyprland ];
-      sddm = {
-        enable = lib.mkDefault true;
-        wayland.enable = lib.mkDefault true;
-        theme = "sddm-astronaut-theme";
-        package = pkgs.kdePackages.sddm;
-        extraPackages = [
-          (pkgs.sddm-astronaut.override { embeddedTheme = "pixel_sakura"; })
-        ] ++ (with pkgs.kdePackages; [
-          qtsvg
-          qtvirtualkeyboard
-          qtmultimedia
-        ]);
+      services.displayManager = {
+        enable = true;
+        # sessionPackages = [ pkgs.hyprland ];
+        sddm = {
+          enable = lib.mkDefault true;
+          wayland.enable = lib.mkDefault true;
+          theme = "sddm-astronaut-theme";
+          package = pkgs.kdePackages.sddm;
+          extraPackages = [
+            (pkgs.sddm-astronaut.override { embeddedTheme = "purple_leaves"; })
+          ] ++ (with pkgs.kdePackages; [
+            qtsvg
+            qtvirtualkeyboard
+            qtmultimedia
+          ]);
+        };
       };
-    };
 
-    security = {
-      polkit.enable = lib.mkDefault true;
-    };
+      security = {
+        polkit.enable = lib.mkDefault true;
+      };
 
-    programs = {
-      dconf.enable = lib.mkDefault true;
-      xwayland.enable = lib.mkDefault true;
-    };
+      programs = {
+        dconf.enable = lib.mkDefault true;
+        xwayland.enable = lib.mkDefault true;
+      };
 
       xdg.portal = {
         enable = true;
@@ -94,64 +96,10 @@ in
         # sddm Theme
         (pkgs.sddm-astronaut.override { embeddedTheme = "purple_leaves"; })
       ];
-    };
 
-    programs.waybar.enable = true;
-
-
-
-    programs.hyprland = {
-      enable = true;
-      withUWSM = true;
-      xwayland.enable = true;
-    };
-
-    services.hypridle.enable = true;
-    systemd.user.services.hypridle.path = [ pkgs.brightnessctl ];
-
-    # programs.hyprlock.enable = true;
-
-    # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1050913
-    xdg.portal.config.hyprland.default = lib.mkDefault [ "wlr" "gtk" ];
-
-    services.xserver.desktopManager.runXdgAutostartIfNone = lib.mkDefault true;
-
-    environment.variables = {
-      QT_QPA_PLATFORM = "wayland;xcb";
-      MOZ_ENABLE_WAYLAND = 1;
-      SDL_VIDEODRIVEWR = "wayland,x11";
-      _JAVA_AWT_WM_NONREPARENTING = 1;
-    };
-
-    environment.systemPackages = with pkgs; [
-      # Screenshotting
-      grim
-      slurp
-      satty
-
-      # Hardware Control
-      brightnessctl
-
-      # Desktop
-      wofi
-      kitty
-      pipewire-controller
-
-      # Wayland Utilities
-      wdisplays
-      xorg.xlsclients
-      wl-clipboard
-
-      # sddm Theme
-      (pkgs.sddm-astronaut.override { embeddedTheme = "purple_leaves"; })
-
-
-      # Cursor Theme
-      inputs.rose-pine-hyprcursor.packages.${pkgs.system}.default
-    ];
-
-    home-manager.sharedModules = [
-      ./home/hyprland.nix
-    ];
-  };
+      home-manager.sharedModules = [
+        ./home/hyprland.nix
+      ];
+    }
+  ]);
 }