{ config, pkgs, lib, ... }: let dwl-startup = pkgs.writeScript "dwl-startup.sh" '' #!${pkgs.bash}/bin/bash exec <&- ''; launch_emacs = pkgs.writeScript "emacsclient-or-start" '' #!${pkgs.bash}/bin/bash emacsclient --create-frame --alternate-editor="" ''; in { imports = [ ./wayland.nix ]; nixpkgs.overlays = [ (final: prev: { dwl = prev.dwl.overrideAttrs (old: let dwl-patches = pkgs.fetchgit { url = "https://codeberg.org/dwl/dwl-patches.git"; rev = "7f93815e9c9d50add8493e680b3057ed0cc6e8a0"; hash = "sha256-LK1+WjAlguBvITPyS4oHXW5bNP19WUEfo87GFmyv8Js="; }; patches = let dwl-patch = p: "${dwl-patches}/patches/${p}/${p}.patch"; in [ (dwl-patch "ipc") (dwl-patch "restore-monitor") (dwl-patch "regexrules") (dwl-patch "regions") ]; in { patches = (old.patches or []) ++ patches; postPatch = '' export termcmd=${pkgs.foot}/bin/foot export editcmd=${launch_emacs} export menucmd=${pkgs.fuzzel}/bin/fuzzel substituteAll ${./dwl/config.def.h} ./config.def.h ''; postInstall = '' sed -i "s#Exec=dwl#Exec=dwl -s ${dwl-startup}#" $out/share/wayland-sessions/dwl.desktop chmod ugo+x $out/share/wayland-sessions/dwl.desktop ''; passthru.providedSessions = ["dwl"]; }); }) ]; environment.sessionVariables = { NIXOS_OZONE_WL=1; WLR_NO_HARDWARE_CURSORS=1; SDL_VIDEODRIVER="wayland"; QT_QPA_PLATFORM="wayland-egl"; QT_WAYLAND_DISABLE_WINDOW_DECORATIONS="1"; __JAVA_AWT_WM_NONREPARENTING=1; # Bug with Wayland: Fixed in 23.1 # Causes firefox & thunderbird to crash # https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21646/diffs?commit_id=ee5d2250fd159689aae3f7d632a6226971bea85c MOZ_ENABLE_WAYLAND=0; }; environment.systemPackages = with pkgs; [ dwl foot ]; }