about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2023-10-01 11:59:13 +0000
committerAlyssa Ross <hi@alyssa.is>2023-10-01 12:00:26 +0000
commite675b3d34cbe5347280b28cb449dbb5c1d110dff (patch)
tree0b7207e7bb148491ddc7d919d626328116ad4b97
parentdc971f34681f628565cbb40958fa82459a33cde7 (diff)
downloadnixlib-e675b3d34cbe5347280b28cb449dbb5c1d110dff.tar
nixlib-e675b3d34cbe5347280b28cb449dbb5c1d110dff.tar.gz
nixlib-e675b3d34cbe5347280b28cb449dbb5c1d110dff.tar.bz2
nixlib-e675b3d34cbe5347280b28cb449dbb5c1d110dff.tar.lz
nixlib-e675b3d34cbe5347280b28cb449dbb5c1d110dff.tar.xz
nixlib-e675b3d34cbe5347280b28cb449dbb5c1d110dff.tar.zst
nixlib-e675b3d34cbe5347280b28cb449dbb5c1d110dff.zip
modules/emacs: build init with packages available
Otherwise it complains about not being able to find them.
-rw-r--r--modules/workstation/emacs/default.nix123
-rw-r--r--modules/workstation/emacs/init.el9
2 files changed, 68 insertions, 64 deletions
diff --git a/modules/workstation/emacs/default.nix b/modules/workstation/emacs/default.nix
index ed4c4e4f8254..ce1b09a31bb9 100644
--- a/modules/workstation/emacs/default.nix
+++ b/modules/workstation/emacs/default.nix
@@ -1,70 +1,71 @@
 { config, pkgs, ... }:
 
+let
+  emacs = ((with pkgs; emacsPackagesFor emacs29-pgtk).emacsWithPackages (epkgs: with epkgs; [
+    adoc-mode
+    cmake-mode
+    code-review
+    csharp-mode
+    d-mode
+    direnv
+    dockerfile-mode
+    ebuild-mode
+    editorconfig
+    eglot
+    elpher
+    execline
+    forge
+    gn-mode
+    gnuplot-mode
+    go-mode
+    graphql-mode
+    graphviz-dot-mode
+    groovy-mode
+    haskell-mode
+    jam-mode
+    just-mode
+    kotlin-mode
+    lua-mode
+    magit
+    markdown-mode
+    meson-mode
+    monokai-theme
+    mutt-mode
+    ninja-mode
+    nix-mode
+    notmuch
+    org-roam
+    pass
+    pod-mode
+    protobuf-mode
+    rainbow-delimiters
+    rust-mode
+    sdlang-mode
+    sort-words
+    toml-mode
+    tuareg
+    typescript-mode
+    udev-mode
+    vala-mode
+    yaml-mode
+    zig-mode
+  ]));
+in
+
 {
-  environment.systemPackages = [
-    ((with pkgs; emacsPackagesFor emacs29-pgtk).emacsWithPackages (epkgs: with epkgs; [
-      adoc-mode
-      cmake-mode
-      code-review
-      csharp-mode
-      d-mode
-      direnv
-      dockerfile-mode
-      ebuild-mode
-      editorconfig
-      eglot
-      elpher
-      execline
-      forge
-      gn-mode
-      gnuplot-mode
-      go-mode
-      graphql-mode
-      graphviz-dot-mode
-      groovy-mode
-      haskell-mode
-      jam-mode
-      just-mode
-      kotlin-mode
-      lua-mode
-      magit
-      markdown-mode
-      meson-mode
-      monokai-theme
-      mutt-mode
-      ninja-mode
-      nix-mode
-      notmuch
-      org-roam
-      pass
-      pod-mode
-      protobuf-mode
-      rainbow-delimiters
-      rust-mode
-      sdlang-mode
-      sort-words
-      toml-mode
-      tuareg
-      typescript-mode
-      udev-mode
-      vala-mode
-      yaml-mode
-      zig-mode
-    ]))
-  ];
+  environment.systemPackages = [ emacs ];
 
   systemd.tmpfiles.rules = [
     "d ${config.users.users.qyliss.home}/notes 0700 qyliss qyliss"
   ];
 
-  users.users.qyliss.xdg.config.paths."emacs" = with pkgs;
-    runCommand ".emacs.d" {
-      nativeBuildInputs = [ emacs29-pgtk ];
-    } ''
-      cp ${./early-init.el} early-init.el
-      cp ${./init.el} init.el
-      emacs -L . --batch -f batch-byte-compile *.el
-      install -d $out
-      install *.el *.elc $out
-    '';
+  users.users.qyliss.xdg.config.paths."emacs" = pkgs.runCommand ".emacs.d" {
+    nativeBuildInputs = [ emacs ];
+  } ''
+    cp ${./early-init.el} early-init.el
+    cp ${./init.el} init.el
+    emacs -L . --batch -f batch-byte-compile *.el
+    install -d $out
+    install *.el *.elc $out
+  '';
 }
diff --git a/modules/workstation/emacs/init.el b/modules/workstation/emacs/init.el
index f34cbc35981d..752362bf59ee 100644
--- a/modules/workstation/emacs/init.el
+++ b/modules/workstation/emacs/init.el
@@ -186,9 +186,6 @@ point."
     (transient-append-suffix command ["-S"]
       '("=S" "Don't sign using gpg" "--no-gpg-sign"))))
 
-;;; mail ;;;
-(setq mail-user-agent 'notmuch-user-agent)
-
 ;;; Markdown ;;;
 (setq-default markdown-hide-markup t)
 
@@ -223,6 +220,12 @@ point."
 	(:name "lists" :query "-tag:done to:afra@afra-berlin.de OR to:@list.skarnet.org OR wayland-devel@lists.freedesktop.org OR to:distributions@lists.linux.dev" :key "l")))
 (setq notmuch-tagging-keys '(("d" ("+done") "done")))
 
+;;; mail ;;;
+; This has to go after we set the notmuch settings, for some reason,
+; or they are not applied.
+(require 'notmuch-mua)
+(setq mail-user-agent 'notmuch-user-agent)
+
 ;;; Org-mode ;;;
 (setq org-id-locations-file (concat user-emacs-directory "/org-id-locations"))