summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMihai Fufezan <fufexan@protonmail.com>2022-09-09 15:40:30 +0300
committerMihai Fufezan <fufexan@pm.me>2022-09-09 17:01:24 +0300
commit9370c7aa8a0f43b4471626f95013e1bf55539c19 (patch)
tree833685aaf54e752a577cf5e0eb91759b2e6f3919
parent928158bbfb906bd871738d60610d85634d1f8c7e (diff)
Nix modules: add recommendedEnvironment option
-rw-r--r--nix/hm-module.nix16
-rw-r--r--nix/module.nix27
2 files changed, 28 insertions, 15 deletions
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;