{ config , pkgs , lib , ... }: let inherit (pkgs) stdenv; nativeCompileDirectory = "${config.xdg.cacheHome}/emacs/native-compile/"; darwinPath = pkgs.runCommandLocal "path_helper " { } '' eval $(/usr/libexec/path_helper) echo -n $PATH > $out ''; editorScript = pkgs.writeScriptBin "edit" '' #!${pkgs.runtimeShell} if [ -z "$1" ]; then exec ${config.programs.emacs.finalPackage}/bin/emacsclient --create-frame --alternate-editor ${config.programs.emacs.finalPackage}/bin/emacs else exec ${config.programs.emacs.finalPackage}/bin/emacsclient --alternate-editor ${config.programs.emacs.finalPackage}/bin/emacs --create-frame "$@" fi ''; in { imports = [ ../modules/eshell.nix ]; programs.emacs = { enable = true; package = lib.mkDefault (pkgs.emacs29.override { withGTK3 = true; }); overrides = self: super: ( { consult-ghq = super.consult-ghq.overrideAttrs (oldAttrs: { src = pkgs.fetchFromGitHub { owner = "alanpearce"; repo = "consult-ghq"; rev = "3a0b366ef2e066c0d941a19d22d5a23d7f778535"; sha256 = "0v7z61nx6xyhxbqkjangqrnay7pp74w4m90wfb29l99p1wkxqbzx"; }; }); } ); eshell = { aliases = { pk = "eshell-up-pk $1"; up = "eshell-up $1"; ec = "find-file $1"; l = "ls $*"; la = "ls -A $*"; ll = "ls -lh $*"; lla = "ls -lhA $*"; http = "xh"; https = "xh --default-scheme https $*"; xhs = "xh --default-scheme https $*"; ava = "npx ava $*"; bunyan = "npx bunyan $*"; mocha = "npx mocha $*"; standard = "npx standard $*"; tsc = "npx tsc $*"; tslnt = "npx tslnt $*"; tsnode = "npx tsnode $*"; kx = "kubectx $*"; kns = "kubens $*"; cdg = "cd (project-root)"; }; }; extraPackages = epkgs: (with epkgs; [ ace-link apheleia auto-sudoedit avy benchmark-init capf-autosuggest clojure-mode cask-mode company company-posframe company-shell company-tabnine consult consult-dir consult-ghq consult-eglot crux dired-git-info docker-compose-mode dockerfile-mode dtrt-indent envrc editorconfig eldoc-box embark embark-consult esh-buf-stack esh-help eshell-fringe-status eshell-toggle eshell-up evil evil-anzu evil-collection evil-commentary evil-embrace evil-matchit evil-mu4e evil-numbers evil-org evil-quickscope evil-space evil-surround evil-textobj-tree-sitter eyebrowse fish-mode feature-mode format-all flycheck general git-gutter-fringe git-modes git-timemachine goto-chg helpful ibuffer-project jinx just-mode justl json-mode lua-mode lispy lispyville magit magit-filenotify markdown-mode marginalia nerd-icons doom-modeline php-mode persist-state posframe quickrun rainbow-mode rainbow-delimiters stimmung-themes toml-mode treesit-grammars.with-all-grammars use-package vc-msg vertico vertico-prescient wgrep-ag ws-butler which-key yaml-mode ]); extraConfig = '' (with-eval-after-load 'editorconfig (setq editorconfig-exec-path "${pkgs.editorconfig-core-c}/bin/editorconfig")) (when (featurep 'native-compile) (setq native-compile-target-directory "${nativeCompileDirectory}") (add-to-list 'native-comp-eln-load-path "${nativeCompileDirectory}" :append)) '' + lib.optionalString stdenv.isDarwin '' (with-eval-after-load 'files (setq insert-directory-program "${pkgs.coreutils-prefixed}/bin/gls")) (with-eval-after-load 'dired (setq dired-use-ls-dired t)) (setq exec-path (parse-colon-path (setenv "PATH" "${pkgs.lib.readFile darwinPath}"))) ''; }; home.packages = with pkgs; [ editorScript ]; xdg.configFile."emacs/early-init.el" = { source = ../emacs/early-init.el; }; xdg.configFile."emacs/init.el" = { source = ../emacs/init.el; }; }