# LXQt Desktop Environment with Niri Window Manager # # This module provides LXQt desktop environment components running with # Niri as the Wayland compositor instead of the default window manager. # # Features: # - LXQt panel, settings, file manager, and utilities # - Niri as the tiling Wayland compositor # - Proper Qt theming with LXQt themes and Kvantum # - XDG portals for screen sharing and file dialogs # - Audio, network, and power management integration # # Usage: # Add this to your host configuration: # imports = lib.flatten [ # # ... other imports ... # "hosts/common/optional/lxqt-niri.nix" # "hosts/common/optional/gdm.nix" # or sddm.nix for display manager # ]; # # The session will appear as "LXQt (Niri)" in the session list. # { pkgs, inputs, lib, ... }: { imports = [ inputs.niri.nixosModules.niri ]; # Enable Niri as the window manager programs.niri.enable = true; # Enable LXQt desktop environment components # Note: We don't enable services.xserver.desktopManager.lxqt.enable = true # because it would conflict with our custom display manager configuration services.xserver = { enable = true; }; # Install additional LXQt components and utilities environment.systemPackages = with pkgs; [ # Core LXQt components that work well with other window managers lxqt.lxqt-panel lxqt.lxqt-session lxqt.lxqt-config lxqt.lxqt-themes lxqt.lxqt-notificationd lxqt.lxqt-powermanagement lxqt.lxqt-policykit lxqt.lxqt-archiver lxqt.qterminal lxqt.pcmanfm-qt lxqt.lximage-qt lxqt.qps # Theme engines and styling libsForQt5.qtstyleplugins libsForQt5.qt5ct # System tools that integrate well with LXQt lxqt.pavucontrol-qt qpwgraph # Network management libsForQt5.networkmanager-qt # Custom session script (writeScriptBin "niri-session" '' #!/bin/sh # Set up environment export XDG_CURRENT_DESKTOP=LXQt export XDG_SESSION_DESKTOP=lxqt-niri export DESKTOP_SESSION=lxqt-niri # Start LXQt session components in background ${lxqt.lxqt-session}/bin/lxqt-session & # Start Niri as the main session exec ${niri}/bin/niri '') ]; # Configure XDG portals for better integration xdg.portal = { enable = true; extraPortals = with pkgs; [ xdg-desktop-portal-gtk xdg-desktop-portal-wlr ]; config = { common = { default = ["gtk"]; "org.freedesktop.impl.portal.Screenshot" = ["wlr"]; "org.freedesktop.impl.portal.Screencast" = ["wlr"]; }; }; }; # Use LXQt's polkit agent security.polkit.enable = true; systemd.user.services.lxqt-policykit-agent = { description = "LXQt PolicyKit Agent"; wantedBy = ["graphical-session.target"]; wants = ["graphical-session.target"]; after = ["graphical-session.target"]; serviceConfig = { Type = "simple"; ExecStart = "${pkgs.lxqt.lxqt-policykit}/bin/lxqt-policykit-agent"; Restart = "on-failure"; RestartSec = 1; TimeoutStopSec = 10; }; }; # Configure Qt theming (basic settings) # Note: More specific Qt theming may be handled by system-wide theming modules # Configure Qt theming to use LXQt qt = { platformTheme = lib.mkForce "lxqt"; }; # Environment variables for proper integration environment.sessionVariables = { NIXOS_OZONE_WL = "1"; QT_QPA_PLATFORM = "wayland;xcb"; QT_WAYLAND_DISABLE_WINDOWDECORATION = "1"; QT_AUTO_SCREEN_SCALE_FACTOR = "1"; QT_QPA_PLATFORMTHEME = lib.mkForce "lxqt"; QT_STYLE_OVERRIDE = "kvantum"; DESKTOP_SESSION = "lxqt-niri"; XDG_CURRENT_DESKTOP = "LXQt"; XDG_SESSION_DESKTOP = "lxqt-niri"; }; # Enable necessary services for LXQt functionality services = { # Power management upower.enable = true; }; # Create a custom session file for LXQt + Niri environment.etc."xdg/lxqt/session.conf".text = '' [General] __userfile__=true window_manager=niri ''; # Create desktop entry for the session environment.etc."wayland-sessions/lxqt-niri.desktop".text = '' [Desktop Entry] Name=LXQt (Niri) Comment=LXQt Desktop with Niri Window Manager Exec=niri-session Type=Application Keywords=niri;lxqt;wayland; ''; }