about summary refs log tree commit diff
path: root/modules/common/emacs
diff options
context:
space:
mode:
Diffstat (limited to 'modules/common/emacs')
-rw-r--r--modules/common/emacs/default.nix48
1 files changed, 31 insertions, 17 deletions
diff --git a/modules/common/emacs/default.nix b/modules/common/emacs/default.nix
index fe2618d..3db4393 100644
--- a/modules/common/emacs/default.nix
+++ b/modules/common/emacs/default.nix
@@ -222,23 +222,37 @@ in {
         };
       };
 
-      programs.emacs = {
-        enable = true;
-        package =
-          (pkgs.emacs29.override (finalAttrs: {
-            stdenv = with pkgs;
-              useMoldLinker
-              (withCFlags ["-O3"]
-                (impureUseNativeOptimizations finalAttrs.stdenv));
-          }))
-          .overrideAttrs (_: final: {
-            configureFlags =
-              final.configureFlags
-              ++ [
-                "--without-mailutils"
-                "--without-pop"
-              ];
-          });
+      programs = {
+        emacs = {
+          enable = true;
+          package =
+            (pkgs.emacs29.override (finalAttrs: {
+              stdenv = pkgs.useMoldLinker finalAttrs.stdenv;
+            }))
+            .overrideAttrs (_: final: {
+              configureFlags =
+                (final.configureFlags or [])
+                ++ [
+                  "--without-mailutils"
+                  "--without-pop"
+                ];
+            });
+        };
+
+        bash.initExtra = mkAfter ''
+          # https://github.com/akermu/emacs-libvterm
+          if [[ "$INSIDE_EMACS" = vterm ]] && [[ -n "$EMACS_VTERM_PATH" ]] && [[ -f "$EMACS_VTERM_PATH/etc/emacs-vterm-bash.sh" ]]; then
+              source "$EMACS_VTERM_PATH/etc/emacs-vterm-bash.sh"
+
+              message() {
+                  vterm_cmd message "%s" "$*"
+              }
+
+              find-file() {
+                  vterm_cmd find-file "$(realpath "''${@:-.}")"
+              }
+          fi
+        '';
       };
     };
   };

Consider giving Nix/NixOS a try! <3