about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--configs/shared/.emacs.d/init.el10
-rw-r--r--configs/shared/.emacs.d/wpc/packages/wpc-misc.el2
-rw-r--r--configs/shared/.xsessionrc.shared7
-rw-r--r--emacs.nix141
4 files changed, 155 insertions, 5 deletions
diff --git a/configs/shared/.emacs.d/init.el b/configs/shared/.emacs.d/init.el
index e07157c70f3f..c02b56f3f864 100644
--- a/configs/shared/.emacs.d/init.el
+++ b/configs/shared/.emacs.d/init.el
@@ -1,4 +1,8 @@
 (require 'wpc-package "~/.emacs.d/wpc/packages/wpc-package.el")
+(require 'f)
+(setq user-init-file (or load-file-name (buffer-file-name)))
+(setq user-emacs-directory (f-dirname user-init-file))
+;; TODO: Troubleshoot broken terminator.
 
 ;; load order is intentional
 (require 'constants)
@@ -11,7 +15,7 @@
 (require 'kaomoji)
 
 ;; Google
-(require 'google-stuff)
+;; (require 'google-stuff)
 
 ;; Laptop XF-functionality
 (require 'pulse-audio)
@@ -41,7 +45,7 @@
 (require 'wpc-lisp)
 (require 'wpc-haskell)
 (require 'wpc-reasonml)
-(require 'wpc-ocaml)
+;; (require 'wpc-ocaml)
 (require 'wpc-elixir)
 (require 'wpc-nix)
 (require 'wpc-rust)
@@ -50,3 +54,5 @@
 (require 'wpc-javascript)
 (require 'wpc-java)
 (require 'wpc-prolog)
+
+(run-hooks 'after-init-hook)
diff --git a/configs/shared/.emacs.d/wpc/packages/wpc-misc.el b/configs/shared/.emacs.d/wpc/packages/wpc-misc.el
index a6b1aab50b55..8af54c36ca80 100644
--- a/configs/shared/.emacs.d/wpc/packages/wpc-misc.el
+++ b/configs/shared/.emacs.d/wpc/packages/wpc-misc.el
@@ -13,7 +13,7 @@
 (display-time-mode 1)
 
 ;; disable custom variable entries from being written to ~/.emacs.d/init.el
-(setq custom-file "~/.emacs.d/custom.el")
+(setq custom-file "/tmp/custom.el")
 (load custom-file 'noerror)
 
 ;; integrate Emacs with X11 clipboard
diff --git a/configs/shared/.xsessionrc.shared b/configs/shared/.xsessionrc.shared
index 5c9da5b5a3be..f0f8355a820d 100644
--- a/configs/shared/.xsessionrc.shared
+++ b/configs/shared/.xsessionrc.shared
@@ -26,7 +26,7 @@ tmux new -d -s main
 
 # Start the Emacs server
 # TODO: Consider starting this with `systemctl --user enable emacs.service`
-emacs --daemon
+# emacs --daemon
 
 # Start ssh-agent
 eval "$(ssh-agent -s)"
@@ -42,4 +42,7 @@ compton &
 unclutter &
 
 # Startup Emacs (and EXWM).
-exec dbus-launch --exit-with-session emacs
+# TODO: Does this prevent the Emacs server (i.e. `emacs --daemon`) from running?
+# NOTE: wpcarros-emacs is built with `nix-env -iA emacs -f .` from
+# `CWD=~/Dropbox/dotfiles`
+exec dbus-launch --exit-with-session wpcarros-emacs
diff --git a/emacs.nix b/emacs.nix
new file mode 100644
index 000000000000..8e3bf21d2424
--- /dev/null
+++ b/emacs.nix
@@ -0,0 +1,141 @@
+{ pkgs ? import <nixpkgs> {}
+, tazjinsPkgs ? import (builtins.fetchGit "https://git.tazj.in") {
+    rev = "4c0e0d715f21eeb62594d198ba1eeccb1a2cfb13";
+  }
+}:
+
+let
+  # TODO: Move this function definition to a prelude.nix or elsewhere.
+  identity = x: x;
+
+  # Here is a whitelist of all of the binary dependencies that Emacs relies
+  # on. These are separate from Emacs libraries like dash.el.
+  emacsBinPath = pkgs.lib.strings.makeBinPath [ pkgs.terminator ];
+
+  emacsWithPackages = (pkgs.emacsPackagesNgGen pkgs.emacs26).emacsWithPackages;
+
+  # TODO: Learn more about melpa versus elpa to have a preference.
+  wpcarrosEmacs = emacsWithPackages (epkgs:
+    (with epkgs.elpaPackages; [
+      exwm
+    ]) ++
+
+    (with epkgs.melpaPackages; [
+      base16-theme
+      ivy-pass
+      clipmon # TODO: Prefer an Emacs client for clipmenud.
+      protobuf-mode # TODO: Determine if this is coming from google-emacs.
+      docker
+      evil
+      evil-collection
+      evil-magit
+      evil-leader
+      evil-commentary
+      evil-surround
+      key-chord
+      add-node-modules-path # TODO: Assess whether or not I need this with Nix.
+      web-mode
+      rjsx-mode
+      tide
+      prettier-js
+      flycheck
+      diminish
+      doom-themes
+      neotree # TODO: Remove this dependency from my config.
+      which-key
+      ivy
+      ivy-prescient
+      all-the-icons
+      all-the-icons-ivy
+      alert
+      nix-mode
+      racer
+      rust-mode
+      rainbow-delimiters
+      racket-mode
+      lispyville
+      elisp-slime-nav
+      py-yapf
+      reason-mode
+      elixir-mode
+      company
+      markdown-mode
+      refine
+      deferred
+      magit
+      request
+      pcre2el
+      helpful
+      exec-path-from-shell # TODO: Determine if Nix solves this problem.
+      yasnippet
+      projectile
+      deadgrep
+      counsel
+      counsel-projectile
+      engine-mode # TODO: Learn what this is.
+      eglot
+      dap-mode
+      lsp-ui
+      company-lsp
+      suggest
+      paradox
+      emr
+      flymake-shellcheck
+      fish-mode
+      tuareg
+      haskell-mode
+      lsp-haskell
+      use-package
+      general
+      clojure-mode
+      cider
+      f
+      dash
+      company
+      counsel
+      flycheck
+      ivy
+      magit
+    ]) ++
+
+    # tazjin's packages
+    (with tazjinsPkgs.tools.emacs-pkgs; [
+      dottime
+      term-switcher
+    ]));
+
+# TODO: Do I need `pkgs.lib.fix`?
+in pkgs.lib.fix(self: l: f: pkgs.writeShellScriptBin "wpcarros-emacs" ''
+   export PATH="${emacsBinPath}:$PATH"
+   exec ${wpcarrosEmacs}/bin/emacs \
+     --debug-init \
+     --no-site-file \
+     --no-site-lisp \
+     --directory ${ ./configs/shared/emacs.d/vendor } \
+     --directory ${ ./configs/shared/emacs.d/wpc } \
+     --directory ${ ./configs/shared/emacs.d/wpc/packages } \
+     --load ${ ./configs/shared/emacs.d/init.el } \
+     --no-init-file $@
+'' // {
+  # TODO: Ascertain whether I need this.
+  overrideEmacs = f': self l f';
+
+  # Call with a local.el file containing local system configuration.
+  withLocalConfig = confDir: self confDir f;
+
+  # This accepts the path to a non-Nix built Emacs, so that X and GL linkage
+  # behaves as expected.
+  withLocalEmacs = emacsBin: pkgs.writeShellScriptBin "wpcarros-emacs" ''
+    export PATH="${emacsBinPath}:$PATH"
+    export EMACSLOADPATH="${wpcarrosEmacs.deps}/share/emacs/site-lisp:"
+    exec ${emacsBin} \
+      --debug-init \
+      --no-site-file \
+      --no-site-lisp \
+      --directory ${ ./configs/shared/emacs.d/vendor } \
+      --directory ${ ./configs/shared/emacs.d/wpc } \
+      --directory ${ ./configs/shared/emacs.d/wpc/packages } \
+      --load ${ ./configs/shared/emacs.d/init.el } \
+      --no-init-file $@
+  '';
+}) null identity