summaryrefslogtreecommitdiff
path: root/overlays/emacs/builder.nix
diff options
context:
space:
mode:
Diffstat (limited to 'overlays/emacs/builder.nix')
-rw-r--r--overlays/emacs/builder.nix33
1 files changed, 33 insertions, 0 deletions
diff --git a/overlays/emacs/builder.nix b/overlays/emacs/builder.nix
new file mode 100644
index 0000000..8c3349c
--- /dev/null
+++ b/overlays/emacs/builder.nix
@@ -0,0 +1,33 @@
+# https://github.com/jwiegley/nix-config/blob/4d296ad/overlays/emacs/builder.nix
+{ stdenv
+, emacs
+, name
+, src
+, buildInputs ? []
+, patches ? []
+, preBuild ? ""
+}:
+
+stdenv.mkDerivation {
+ inherit name src patches;
+ unpackCmd = ''
+ test -f "${src}" && mkdir el && cp -p ${src} el/${name}
+ '';
+ buildInputs = [ emacs ] ++ buildInputs;
+ buildPhase = ''
+ ${preBuild}
+ ARGS=$(find ${stdenv.lib.concatStrings
+ (builtins.map (arg: arg + "/share/emacs/site-lisp ") buildInputs)} \
+ -type -d -exec -L {} \;)
+ ${emacs}/bin/emacs -Q -nw -L . ${ARGS} --batch -f batch-byte-compile *.el
+ '';
+ installPhase = ''
+ mkdir -p ${out}/share/emacs/site-lisp
+ install *.el* ${out/share/emacs/site-lisp
+ '';
+ meta = {
+ description = "Emacs projects from the Internet that just compile `.el` files";
+ homepage = http://www.emacswiki.org;
+ platforms = stdenv.lib.platforms.all;
+ };
+} \ No newline at end of file