From 1d631c8a233257738a08b3e5aebc8df22d3253fe Mon Sep 17 00:00:00 2001 From: Mihai Fufezan Date: Wed, 7 Sep 2022 00:45:24 +0300 Subject: [PATCH] Nix modules: add common environment variables --- nix/hm-module.nix | 12 ++++++++++++ nix/module.nix | 31 ++++++++++++++++++++++++------- 2 files changed, 36 insertions(+), 7 deletions(-) diff --git a/nix/hm-module.nix b/nix/hm-module.nix index 0f4e8a3b..be678ba4 100644 --- a/nix/hm-module.nix +++ b/nix/hm-module.nix @@ -81,6 +81,18 @@ in { lib.optional (cfg.package != null) cfg.package ++ lib.optional cfg.xwayland.enable pkgs.xwayland; + home.sessionVariables = { + CLUTTER_BACKEND = lib.mkDefault "wayland"; + GDK_BACKEND = lib.mkDefault "wayland"; + _JAVA_AWT_WM_NONREPARENTING = lib.mkDefault "1"; + MOZ_ENABLE_WAYLAND = lib.mkDefault "1"; + NIXOS_OZONE_WL = lib.mkDefault "1"; + QT_QPA_PLATFORM = lib.mkDefault "wayland;xcb"; + QT_WAYLAND_DISABLE_WINDOWDECORATION = lib.mkDefault "1"; + XCURSOR_SIZE = lib.mkDefault toString config.home.pointerCursor.size or "24"; + XDG_SESSION_TYPE = lib.mkDefault "wayland"; + }; + xdg.configFile."hypr/hyprland.conf" = { text = (lib.optionalString cfg.systemdIntegration '' diff --git a/nix/module.nix b/nix/module.nix index 9969d0eb..31ecdbdc 100644 --- a/nix/module.nix +++ b/nix/module.nix @@ -33,14 +33,31 @@ in { }; config = mkIf cfg.enable { - environment.systemPackages = lib.optional (cfg.package != null) cfg.package; - security.polkit.enable = true; - hardware.opengl.enable = mkDefault true; + environment = { + systemPackages = lib.optional (cfg.package != null) cfg.package; + sessionVariables = { + CLUTTER_BACKEND = lib.mkDefault "wayland"; + GDK_BACKEND = lib.mkDefault "wayland"; + _JAVA_AWT_WM_NONREPARENTING = lib.mkDefault "1"; + MOZ_ENABLE_WAYLAND = lib.mkDefault "1"; + NIXOS_OZONE_WL = lib.mkDefault "1"; + QT_QPA_PLATFORM = lib.mkDefault "wayland;xcb"; + QT_WAYLAND_DISABLE_WINDOWDECORATION = lib.mkDefault "1"; + XCURSOR_SIZE = lib.mkDefault "24"; + XDG_SESSION_TYPE = lib.mkDefault "wayland"; + }; + }; fonts.enableDefaultFonts = mkDefault true; - programs.dconf.enable = mkDefault true; + hardware.opengl.enable = mkDefault true; + programs = { + dconf.enable = mkDefault true; + xwayland.enable = mkDefault true; + }; + security.polkit.enable = true; services.xserver.displayManager.sessionPackages = lib.optional (cfg.package != null) cfg.package; - programs.xwayland.enable = mkDefault true; - xdg.portal.enable = mkDefault true; - xdg.portal.extraPortals = [pkgs.xdg-desktop-portal-wlr]; + xdg.portal = { + enable = mkDefault true; + portal.extraPortals = [pkgs.xdg-desktop-portal-wlr]; + }; }; }