diff options
Diffstat (limited to 'users/tazjin/emacs/default.nix')
-rw-r--r-- | users/tazjin/emacs/default.nix | 96 |
1 files changed, 53 insertions, 43 deletions
diff --git a/users/tazjin/emacs/default.nix b/users/tazjin/emacs/default.nix index 5b778be1d9..46843432f1 100644 --- a/users/tazjin/emacs/default.nix +++ b/users/tazjin/emacs/default.nix @@ -1,11 +1,12 @@ # This file builds an Emacs pre-configured with the packages I need # and my personal Emacs configuration. -{ lib, pkgs, ... }: +{ depot, lib, pkgs, ... }: pkgs.makeOverridable - ({ emacs ? pkgs.emacsNativeComp }: + ({ emacs ? pkgs.emacs29 }: let - emacsWithPackages = (pkgs.emacsPackagesFor emacs).emacsWithPackages; + emacsPackages = (pkgs.emacsPackagesFor emacs); + emacsWithPackages = emacsPackages.emacsWithPackages; # If switching telega versions, use this variable because it will # keep the version check, binary path and so on in sync. @@ -19,6 +20,30 @@ pkgs.makeOverridable identity = x: x; + # tree-sitter grammars for various ts-modes + customTreesitGrammars = emacs.pkgs.treesit-grammars.with-grammars (g: with g; [ + tree-sitter-bash + tree-sitter-c + tree-sitter-cmake + tree-sitter-cpp + tree-sitter-css + tree-sitter-dockerfile + tree-sitter-go + tree-sitter-gomod + tree-sitter-hcl + tree-sitter-html + tree-sitter-java + tree-sitter-json + tree-sitter-latex + tree-sitter-make + tree-sitter-nix + tree-sitter-python + tree-sitter-rust + tree-sitter-sql + tree-sitter-toml + tree-sitter-yaml + ]); + tazjinsEmacs = pkgfun: (emacsWithPackages (epkgs: pkgfun (with epkgs; [ ace-link ace-window @@ -27,21 +52,13 @@ pkgs.makeOverridable browse-kill-ring cargo clojure-mode - cmake-mode - company - counsel - counsel-notmuch - d-mode + consult deft direnv - dockerfile-mode - eglot - elfeed elixir-mode elm-mode erlang - exwm - flymake + depotExwm go-mode google-c-style gruber-darker-theme @@ -49,15 +66,12 @@ pkgs.makeOverridable ht hydra idle-highlight-mode - ivy - ivy-prescient + inspector jq-mode kotlin-mode - lsp-mode + kubernetes magit markdown-toc - meson-mode - multi-term multiple-cursors nginx-mode nix-mode @@ -65,37 +79,36 @@ pkgs.makeOverridable paredit password-store pinentry - polymode prescient protobuf-mode rainbow-delimiters rainbow-mode - refine request restclient rust-mode sly - string-edit - swiper - telephone-line + string-edit-at-point terraform-mode - toml-mode - transient undo-tree - use-package uuidgen + vertico vterm web-mode websocket which-key xelb - yaml-mode yasnippet zetteldeft zoxide + # experimental (not otherwise embedded in config yet) + orderless + corfu + eat + # Wonky stuff (currentTelega epkgs) + customTreesitGrammars # TODO(tazjin): how is this *supposed* to work?! # Custom depot packages (either ours, or overridden ones) tvlPackages.dottime @@ -103,7 +116,11 @@ pkgs.makeOverridable tvlPackages.passively tvlPackages.rcirc tvlPackages.term-switcher + tvlPackages.treecrumbs tvlPackages.tvl + + # Dynamic/native modules + depot.users.tazjin.gio-list-apps ]))); # Tired of telega.el runtime breakages through tdlib @@ -124,7 +141,7 @@ pkgs.makeOverridable (kill-emacs 1)) ''; in - pkgs.runCommandNoCC "tdlibCheck" { } '' + pkgs.runCommand "tdlibCheck" { } '' export PATH="${emacsBinPath}:$PATH" ${tgEmacs}/bin/emacs --script ${verifyTdlibVersion} && touch $out ''; @@ -138,10 +155,18 @@ pkgs.makeOverridable --no-site-lisp \ --no-init-file \ --directory ${./config} ${if l != null then "--directory ${l}" else ""} \ + --eval "(add-to-list 'treesit-extra-load-path \"${customTreesitGrammars}/lib\")" \ --eval "(require 'init)" $@ '').overrideAttrs (_: { passthru = { + # Expose original Emacs used for my configuration. + inherit emacs; + + # Expose the pure emacs with all packages. + inherit emacsPackages; + emacsWithPackages = tazjinsEmacs f; + # Call overrideEmacs with a function (pkgs -> pkgs) to modify the # packages that should be included in this Emacs distribution. overrideEmacs = f': self l f'; @@ -150,21 +175,6 @@ pkgs.makeOverridable # `local.el` which provides local system configuration. withLocalConfig = confDir: self confDir f; - # Build a derivation that uses the specified local Emacs (i.e. - # built outside of Nix) instead - withLocalEmacs = emacsBin: pkgs.writeShellScriptBin "tazjins-emacs" '' - export PATH="${emacsBinPath}:$PATH" - export EMACSLOADPATH="${(tazjinsEmacs f).deps}/share/emacs/site-lisp:" - exec ${emacsBin} \ - --debug-init \ - --no-site-file \ - --no-site-lisp \ - --no-init-file \ - --directory ${./config} \ - ${if l != null then "--directory ${l}" else ""} \ - --eval "(require 'init)" $@ - ''; - # Expose telega/tdlib version check as a target that is built in # CI. # |