diff --git a/nix/hm-module.nix b/nix/hm-module.nix index 4134a6ed..2c653d2e 100644 --- a/nix/hm-module.nix +++ b/nix/hm-module.nix @@ -67,6 +67,16 @@ in { ''; }; + recommendedEnvironment = lib.mkOption { + type = lib.types.bool; + default = true; + defaultText = lib.literalExpression "true"; + example = lib.literalExpression "false"; + description = '' + Whether to set the recommended environment variables. + ''; + }; + imports = [ ( lib.mkRenamedOptionModule @@ -81,14 +91,10 @@ in { lib.optional (cfg.package != null) cfg.package ++ lib.optional cfg.xwayland.enable pkgs.xwayland; - home.sessionVariables = { - CLUTTER_BACKEND = "wayland"; + home.sessionVariables = lib.mkIf cfg.recommendedEnvironment { GDK_BACKEND = "wayland"; _JAVA_AWT_WM_NONREPARENTING = "1"; - MOZ_ENABLE_WAYLAND = "1"; NIXOS_OZONE_WL = "1"; - QT_QPA_PLATFORM = "wayland;xcb"; - QT_WAYLAND_DISABLE_WINDOWDECORATION = "1"; XCURSOR_SIZE = toString config.home.pointerCursor.size or "24"; XDG_SESSION_TYPE = "wayland"; }; diff --git a/nix/module.nix b/nix/module.nix index 2dc8659a..395a020b 100644 --- a/nix/module.nix +++ b/nix/module.nix @@ -30,21 +30,28 @@ in { Hyprland package to use. ''; }; + + recommendedEnvironment = mkOption { + type = types.bool; + default = true; + defaultText = literalExpression "true"; + example = literalExpression "false"; + description = '' + Whether to set the recommended environment variables. + ''; + }; }; config = mkIf cfg.enable { 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"; + + sessionVariables = mkIf cfg.recommendedEnvironment { + GDK_BACKEND = "wayland"; + _JAVA_AWT_WM_NONREPARENTING = "1"; + NIXOS_OZONE_WL = "1"; + XCURSOR_SIZE = "24"; + XDG_SESSION_TYPE = "wayland"; }; }; fonts.enableDefaultFonts = mkDefault true;