{ lib, config, pkgs, modulesPath, inputs, ... }: let cfg = config.cspark-desktop-niri; in { imports = [ inputs.niri.nixosModules.niri ]; options.cspark-desktop-niri = { enable = lib.mkEnableOption "Enable Custom Niri Desktop Setup"; }; config = lib.mkIf cfg.enable { # Enable the Niri Compositor and add extra system packages. programs.niri = { enable = true; package = pkgs.niri; }; environment.systemPackages = with pkgs; [ wl-clipboard swaylock # Locking swayidle # Idle Detection (For locking) swaybg # Set background wallpaper foot # Terminal Emulator kitty libsixel # Load images in foot #ghostty # Terminal Emulator fuzzel # Application Launcher - Wayland wdisplays # Manage wayland displays wlr-randr # Manage wayland displays - xrandr clone wlsunset # Day/night gamma adjustment/filter for wayland brightnessctl # GNU/Linux application to control backlights mako # Notification Daemon wlprop # Clone of X11 xprop for wayland (To get window class names etc) wev # Clone of X11 xev for wayland waybar # Status bar xwayland-satellite # Xwayland support outside your Wayland compositor udiskie # Automount of removable media swayimg # Image viewer #lxqt.pcmanfm-qt # File Manager nautilus # File Manager #lxqt.lxqt-archiver # Archiver - Issues compiling qt6Packages.qt6ct # Manage QT6 Themes libsForQt5.qt5ct # Manage QT5 Themes lxappearance # Manage GTK Themes kdePackages.polkit-kde-agent-1 # Polkit Prompt for password prompts etc lxqt.lxqt-openssh-askpass # GUI to query passwords on behalf of SSH agents - Issues compiling zathura # PDF Viewer zenity # Display custom prompts (writeShellScriptBin "zenity-askpass" '' zenity --password '') pavucontrol # Audio control pipewire.jack (writeShellScriptBin "niri-start-session" '' export TERM="foot" # export TERM="ghostty" export QT_QPA_PLATFORM="wayland" export QT_QPA_PLATFORMTHEME="qt6ct" export QT_WAYLAND_DISABLE_WINDOWDECORATION="1" export SDL_VIDEODRIVER="wayland,x11,windows" export _JAVA_AWT_WM_NONREPARENTING="1" export SSH_ASKPASS_REQUIRE="force" export SSH_ASKPASS="/run/current-system/sw/bin/lxqt-openssh-askpass" # export SSH_ASKPASS="/run/current-system/sw/bin/zenity-askpass" export MOZ_ENABLE_WAYLAND="1" # Enable native wayland support for chromium and electron based applications export NIXOS_OZONE_WL="1" # Xwayland support via xwayland-satellite-flake export DISPLAY=":0" niri-session '') ]; # The minimal login manager I'm using for niri services.greetd = { enable = true; settings = { default_session = { command = "${pkgs.greetd.tuigreet}/bin/tuigreet --time --cmd niri-start-session"; user = "greeter"; }; }; }; # XDG Portal Integration (For file chooser/screensharing etc) xdg.portal.enable = true; xdg.portal.wlr.enable = true; xdg.portal.extraPortals = with pkgs; [ xdg-desktop-portal-gnome xdg-desktop-portal-gtk ]; # Whether to enable Qt configuration, including theming. qt.enable = true; # Enable polkit security.polkit.enable = true; # For udiskie services.udisks2.enable = true; # Xwayland setup programs.xwayland.enable = true; services.xserver.display = 0; services.xserver.enable = true; # Whether to enable GNOME Keyring daemon, a service designed to take care of the user’s security credentials, such as user names and passwords. services.gnome.gnome-keyring.enable = true; # GTK themes are not applied in Wayland applications / Window Decorations missing / Cursor looks different programs.dconf.enable = true; # Enable CUPS to print documents. services.printing.enable = true; # Enable sound with pipewire. security.rtkit.enable = true; services.pulseaudio.enable = lib.mkForce false; # PipeWire users must be in the `pipewire` group #users.users.myservice1.extraGroups = [ "pipewire" ]; #systemd.services.myservice2.serviceConfig.SupplementaryGroups = [ "pipewire" ]; services.pipewire = { enable = true; systemWide = true; alsa.enable = true; alsa.support32Bit = true; pulse.enable = true; # # If you want to use JACK applications, uncomment this jack.enable = true; # use the example session manager (no others are packaged yet so this is enabled by default, # no need to redefine it in your config for now) #media-session.enable = true; # Virtual mic to route processed microphone or other devices simultaneously into extraConfig.pipewire."91-processed-mic" = { "context.objects" = [ { factory = "adapter"; args = { "factory.name" = "support.null-audio-sink"; "node.name" = "Processed-Mic"; "node.description" = "Virtual Processed Microphone"; "media.class" = "Audio/Source/Virtual"; "audio.position" = "FL,FR"; }; } ]; }; }; security.sudo = { extraRules = [ { commands = [ { command = "/run/current-system/sw/bin/brightnessctl"; options = [ "NOPASSWD" ]; } ]; groups = [ "wheel" ]; } ]; }; programs.ssh = { enableAskPassword = true; askPassword = "/run/current-system/sw/bin/lxqt-openssh-askpass"; #askPassword = "/run/current-system/sw/bin/zenity-askpass"; }; environment.sessionVariables = { TERM = "foot"; # TERM = "ghostty"; QT_QPA_PLATFORM = "wayland"; QT_QPA_PLATFORMTHEME = "qt6ct"; QT_WAYLAND_DISABLE_WINDOWDECORATION = "1"; SDL_VIDEODRIVER = "wayland,x11,windows"; _JAVA_AWT_WM_NONREPARENTING = "1"; SSH_ASKPASS_REQUIRE = "force"; SSH_ASKPASS = "/run/current-system/sw/bin/lxqt-openssh-askpass"; #SSH_ASKPASS = "/run/current-system/sw/bin/zenity-askpass"; MOZ_ENABLE_WAYLAND = "1"; # Enable native wayland support for chromium and electron based applications NIXOS_OZONE_WL = "1"; # Xwayland support via xwayland-satellite-flake DISPLAY = ":0"; }; environment.variables = { TERM = "foot"; # TERM = "ghostty"; QT_QPA_PLATFORM = "wayland"; QT_QPA_PLATFORMTHEME = "qt6ct"; QT_WAYLAND_DISABLE_WINDOWDECORATION = "1"; SDL_VIDEODRIVER = "wayland,x11,windows"; _JAVA_AWT_WM_NONREPARENTING = "1"; SSH_ASKPASS_REQUIRE = "force"; SSH_ASKPASS = lib.mkForce "/run/current-system/sw/bin/lxqt-openssh-askpass"; #SSH_ASKPASS = lib.mkForce "/run/current-system/sw/bin/zenity-askpass"; MOZ_ENABLE_WAYLAND = "1"; # Enable native wayland support for chromium and electron based applications NIXOS_OZONE_WL = "1"; # Xwayland support via xwayland-satellite-flake DISPLAY = ":0"; }; environment.extraInit = '' export DISPLAY=:0 ''; environment.shellInit = '' export DISPLAY=:0 ''; environment.profileRelativeSessionVariables = { DISPLAY = [ ":0" ]; }; }; }