about summary refs log tree commit diff
path: root/nix/writeElispBin
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2020-12-01T12·16+0100
committertazjin <mail@tazj.in>2020-12-01T12·55+0000
commit87f1e15baa5491dcfd1b66102909d1ba1b75c175 (patch)
tree4a89e3736c25811236c4acf1221d5d86b64d348e /nix/writeElispBin
parent6c08bcc84d51fd5a1a5152b3c611df44c93a3f00 (diff)
chore(writeElispBin): Move from //overrides to //nix r/1971
... some legacy cleanup ...

Change-Id: I9e73451256f842e75ddbf1382badaf06c775c755
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2212
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
Diffstat (limited to 'nix/writeElispBin')
-rw-r--r--nix/writeElispBin/default.nix18
1 files changed, 18 insertions, 0 deletions
diff --git a/nix/writeElispBin/default.nix b/nix/writeElispBin/default.nix
new file mode 100644
index 000000000000..c116607e0aeb
--- /dev/null
+++ b/nix/writeElispBin/default.nix
@@ -0,0 +1,18 @@
+{ depot, pkgs, ... }:
+
+{ name, src, deps ? (_: []), emacs ? pkgs.emacs27-nox }:
+
+let
+  inherit (pkgs) emacsPackages emacsPackagesGen;
+  inherit (builtins) isString toFile;
+
+  finalEmacs = (emacsPackagesGen emacs).emacsWithPackages deps;
+
+  srcFile = if isString src
+    then toFile "${name}.el" src
+    else src;
+
+in depot.nix.writeScriptBin name ''
+  #!/bin/sh
+  ${finalEmacs}/bin/emacs --batch --no-site-file --script ${srcFile} $@
+''