From 0220fb319a351db3091727b56e0e3437f33b0b07 Mon Sep 17 00:00:00 2001 From: sterni Date: Tue, 14 Dec 2021 15:36:20 +0100 Subject: feat(users/sterni/emacs): provide BQN interpreter via Nix 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 Autosubmit: sterni --- users/sterni/emacs/default.nix | 27 +++++++++++++++++++++++---- users/sterni/emacs/init.el | 1 + 2 files changed, 24 insertions(+), 4 deletions(-) (limited to 'users/sterni') 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)" \ "$@" '' diff --git a/users/sterni/emacs/init.el b/users/sterni/emacs/init.el index 4b868cb242d1..16116f247216 100644 --- a/users/sterni/emacs/init.el +++ b/users/sterni/emacs/init.el @@ -180,5 +180,6 @@ :mode (("\\.adoc\\'" . adoc-mode))) (require 'subscriptions) +(require 'nix-inject) (provide 'init) -- cgit 1.4.1