about summary refs log tree commit diff
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@google.com>2019-12-16T11·59+0000
committerVincent Ambo <tazjin@google.com>2019-12-16T11·59+0000
commit6ae799e8c8a3ec5c90436be5757ac86e03e7ff4b (patch)
tree8ad41ef1460b6a8fcee1e23a93304e15d43a1d73
parent67a9b3cc52a1088955ea2a969a9705021bb61d56 (diff)
feat(emacs): Make list of packages overridable r/165
Exposes an `overrideEmacs` which can take a package function that
receives the current package list and can make arbitrary modifications
to it.

This makes it possible for me to maintain a private overlay for e.g.
work purposes with packages that should not be visible in my public
repos.
-rw-r--r--tools/emacs/default.nix11
1 files changed, 6 insertions, 5 deletions
diff --git a/tools/emacs/default.nix b/tools/emacs/default.nix
index 9d472f03c194..8d12bcb11dbf 100644
--- a/tools/emacs/default.nix
+++ b/tools/emacs/default.nix
@@ -11,7 +11,8 @@ let
   localPackages = pkgs.tools.emacs-pkgs;
   emacsWithPackages = (third_party.emacsPackagesNgGen third_party.emacs26).emacsWithPackages;
 
-  tazjinsEmacs = (emacsWithPackages(epkgs:
+  identity = x: x;
+  tazjinsEmacs = pkgfun: (emacsWithPackages(epkgs: pkgfun(
   # Actual ELPA packages (the enlightened!)
   (with epkgs.elpaPackages; [
     ace-window
@@ -82,13 +83,13 @@ let
 
   # Custom packages
   [ carp-mode localPackages.dottime localPackages.term-switcher ]
-  ));
-in third_party.writeShellScriptBin "tazjins-emacs" ''
-  exec ${tazjinsEmacs}/bin/emacs \
+  )));
+in lib.fix(self: f: third_party.writeShellScriptBin "tazjins-emacs" ''
+  exec ${tazjinsEmacs f}/bin/emacs \
     --debug-init \
     --no-site-file \
     --no-site-lisp \
     --no-init-file \
     --directory ${./config} \
     --eval "(require 'init)" $@
-''
+  '' // { overrideEmacs = f': self f'; }) identity