{pkgs, ...}: with pkgs; let sources = import ../_sources/generated.nix {inherit (pkgs) fetchurl fetchFromGitHub fetchgit dockerTools;}; in emacsWithPackagesFromUsePackage { config = ./init.org; defaultInitFile = true; package = if pkgs.stdenv.isDarwin then emacs29-pgtk.overrideAttrs (old: let getPatch = name: sources.${name}.src; in { patches = (old.patches or []) ++ [ # Fix OS window role (needed for window managers like yabai) (getPatch "fix-window-role") # Use poll instead of select to get file descriptors (getPatch "poll") # Enable rounded window with no decoration (getPatch "round-undecorated-frame") # Make Emacs aware of OS-level light/dark mode (getPatch "system-appearance") ]; }) else pkgs.emacs29-pgtk; alwaysEnsure = true; alwaysTangle = true; extraEmacsPackages = epkgs: with epkgs; [ treemacs treemacs-evil ] ++ lib.optionals stdenv.isDarwin [ ns-auto-titlebar ]; override = epkgs: epkgs // { sideline-eglot = callPackage ./extraPackages/sideline-eglot.nix { inherit sources; inherit (epkgs) trivialBuild sideline; }; intuitive-tab-line = callPackage ./extraPackages/intuitive-tab-line.nix { inherit sources; inherit (epkgs) trivialBuild; }; }; }