about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--users/sterni/emacs/default.nix27
-rw-r--r--users/sterni/emacs/init.el1
2 files changed, 24 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)"       \
     "$@"
 ''
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)