From a4160dfe88eeb857a66340335da60032b3eda2ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABlys=20Bras=20de=20fer?= Date: Wed, 22 May 2024 18:40:25 +0200 Subject: [PATCH] nixos/hyprland: use generic wayland-session module --- nixos/modules/programs/wayland/hyprland.nix | 49 ++++++++----------- .../programs/wayland/wayland-session.nix | 9 +--- 2 files changed, 22 insertions(+), 36 deletions(-) diff --git a/nixos/modules/programs/wayland/hyprland.nix b/nixos/modules/programs/wayland/hyprland.nix index c963429f2e2a..89e0159779d9 100644 --- a/nixos/modules/programs/wayland/hyprland.nix +++ b/nixos/modules/programs/wayland/hyprland.nix @@ -1,8 +1,5 @@ -{ config -, lib -, pkgs -, ... -}: +{ config, lib, pkgs, ... }: + let cfg = config.programs.hyprland; @@ -53,33 +50,29 @@ in }; }; - config = lib.mkIf cfg.enable { - environment.systemPackages = [ cfg.finalPackage ]; + config = lib.mkIf cfg.enable (lib.mkMerge [ + { + environment.systemPackages = [ cfg.finalPackage ]; - fonts.enableDefaultPackages = lib.mkDefault true; - hardware.opengl.enable = lib.mkDefault true; + services.displayManager.sessionPackages = [ cfg.finalPackage ]; - programs = { - dconf.enable = lib.mkDefault true; - xwayland.enable = lib.mkDefault cfg.xwayland.enable; - }; + xdg.portal = { + extraPortals = [ finalPortalPackage ]; + configPackages = lib.mkDefault [ cfg.finalPackage ]; + }; - security.polkit.enable = true; + systemd = lib.mkIf cfg.systemd.setPath.enable { + user.extraConfig = '' + DefaultEnvironment="PATH=$PATH:/run/current-system/sw/bin:/etc/profiles/per-user/%u/bin:/run/wrappers/bin" + ''; + }; + } - services.displayManager.sessionPackages = [ cfg.finalPackage ]; - - xdg.portal = { - enable = lib.mkDefault true; - extraPortals = [ finalPortalPackage ]; - configPackages = lib.mkDefault [ cfg.finalPackage ]; - }; - - systemd = lib.mkIf cfg.systemd.setPath.enable { - user.extraConfig = '' - DefaultEnvironment="PATH=$PATH:/run/current-system/sw/bin:/etc/profiles/per-user/%u/bin:/run/wrappers/bin" - ''; - }; - }; + (import ./wayland-session.nix { + inherit lib pkgs; + xwayland = cfg.xwayland.enable; + }) + ]); imports = [ (lib.mkRemovedOptionModule diff --git a/nixos/modules/programs/wayland/wayland-session.nix b/nixos/modules/programs/wayland/wayland-session.nix index 09a68929e383..e9c12da156ab 100644 --- a/nixos/modules/programs/wayland/wayland-session.nix +++ b/nixos/modules/programs/wayland/wayland-session.nix @@ -14,12 +14,5 @@ xwayland.enable = lib.mkDefault xwayland; }; - xdg.portal = { - enable = lib.mkDefault true; - - extraPortals = [ - # For screen sharing - pkgs.xdg-desktop-portal-wlr - ]; - }; + xdg.portal.wlr.enable = lib.mkDefault true; }