Nix modules: add common environment variables

This commit is contained in:
Mihai Fufezan 2022-09-07 00:45:24 +03:00 committed by Mihai Fufezan
parent 789eedd115
commit 1d631c8a23
2 changed files with 36 additions and 7 deletions

View file

@ -81,6 +81,18 @@ in {
lib.optional (cfg.package != null) cfg.package lib.optional (cfg.package != null) cfg.package
++ lib.optional cfg.xwayland.enable pkgs.xwayland; ++ 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" = { xdg.configFile."hypr/hyprland.conf" = {
text = text =
(lib.optionalString cfg.systemdIntegration '' (lib.optionalString cfg.systemdIntegration ''

View file

@ -33,14 +33,31 @@ in {
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
environment.systemPackages = lib.optional (cfg.package != null) cfg.package; environment = {
security.polkit.enable = true; systemPackages = lib.optional (cfg.package != null) cfg.package;
hardware.opengl.enable = mkDefault true; 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; 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; services.xserver.displayManager.sessionPackages = lib.optional (cfg.package != null) cfg.package;
programs.xwayland.enable = mkDefault true; xdg.portal = {
xdg.portal.enable = mkDefault true; enable = mkDefault true;
xdg.portal.extraPortals = [pkgs.xdg-desktop-portal-wlr]; portal.extraPortals = [pkgs.xdg-desktop-portal-wlr];
};
}; };
} }