about summary refs log tree commit diff
path: root/users/sterni/emacs/default.nix
diff options
context:
space:
mode:
authorsterni <sternenseemann@systemli.org>2021-12-14T14·36+0100
committerclbot <clbot@tvl.fyi>2021-12-14T17·07+0000
commit0220fb319a351db3091727b56e0e3437f33b0b07 (patch)
tree559cd13d44945ad21cc6ccab84e7f5d635e1c179 /users/sterni/emacs/default.nix
parent9f22b4f1c89a2932d6f797a7e1b7dbcae0ca73d2 (diff)
feat(users/sterni/emacs): provide BQN interpreter via Nix r/3241
For this we create a directory containing a nix-inject.el file using
writeTextFile where we can string interpolate as much as we please and
merge that into a single emacs.d directory with the config *.el files
tracked in the normal tree using symlinkJoin.

Change-Id: I0e39591587a54527214783d4380456d2763da091
Reviewed-on: https://cl.tvl.fyi/c/depot/+/4324
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
Autosubmit: sterni <sternenseemann@systemli.org>
Diffstat (limited to 'users/sterni/emacs/default.nix')
-rw-r--r--users/sterni/emacs/default.nix27
1 files changed, 23 insertions, 4 deletions
diff --git a/users/sterni/emacs/default.nix b/users/sterni/emacs/default.nix
index f7bdf21a025e..a3946a47972a 100644
--- a/users/sterni/emacs/default.nix
+++ b/users/sterni/emacs/default.nix
@@ -31,13 +31,32 @@ let
     epkgs.melpaPackages.magit
     epkgs.tvlPackages.tvl
   ]);
+
+  configDirectory = pkgs.symlinkJoin {
+    name = "emacs.d";
+    paths = [
+      ./.
+      (pkgs.writeTextFile {
+        name = "injected-emacs.d";
+        destination = "/nix-inject.el";
+        text = ''
+          (setq bqn-interpreter-path "${pkgs.cbqn}/bin/BQN")
+
+          (provide 'nix-inject)
+        '';
+      })
+    ];
+    postBuild = ''
+      rm "$out/default.nix"
+    '';
+  };
 in
 
 # sadly we can't give an init-file via the command line
 pkgs.writeShellScriptBin "emacs" ''
-  exec ${emacs}/bin/emacs     \
-    --no-init-file            \
-    --directory ${./.}        \
-    --eval "(require 'init)" \
+  exec ${emacs}/bin/emacs          \
+    --no-init-file                 \
+    --directory ${configDirectory} \
+    --eval "(require 'init)"       \
     "$@"
 ''