summary refs log tree commit diff
diff options
context:
space:
mode:
authorThomas Tuegel <ttuegel@gmail.com>2016-01-16 10:02:49 -0600
committerThomas Tuegel <ttuegel@gmail.com>2016-01-18 15:29:17 -0600
commitcd54d7af471213736b989fcc16192f779ff13873 (patch)
treecc38ea291c2800b449f932dc191542850cbca8ad
parent18251778c956bf18a8a70d687ac2b66967c459dd (diff)
downloadnixlib-cd54d7af471213736b989fcc16192f779ff13873.tar
nixlib-cd54d7af471213736b989fcc16192f779ff13873.tar.gz
nixlib-cd54d7af471213736b989fcc16192f779ff13873.tar.bz2
nixlib-cd54d7af471213736b989fcc16192f779ff13873.tar.lz
nixlib-cd54d7af471213736b989fcc16192f779ff13873.tar.xz
nixlib-cd54d7af471213736b989fcc16192f779ff13873.tar.zst
nixlib-cd54d7af471213736b989fcc16192f779ff13873.zip
melpaBuild: don't download dependencies
Stop package.el from trying to download dependencies. It wouldn't work
anyway.
-rw-r--r--pkgs/build-support/emacs/melpa2nix.el19
1 files changed, 18 insertions, 1 deletions
diff --git a/pkgs/build-support/emacs/melpa2nix.el b/pkgs/build-support/emacs/melpa2nix.el
index ea5b1390ad8c..fb35fc681257 100644
--- a/pkgs/build-support/emacs/melpa2nix.el
+++ b/pkgs/build-support/emacs/melpa2nix.el
@@ -12,7 +12,7 @@
   (pcase command-line-args-left
     (`(,archive ,elpa)
      (progn (setq package-user-dir elpa)
-            (package-install-file archive)))))
+            (melpa2nix-install-file archive)))))
 
 (defun melpa2nix-build-package ()
   (if (not noninteractive)
@@ -48,3 +48,20 @@
                             (time-to-seconds (time-since start-time))
                             (current-time-string))
       (princ (format "%s\n" archive-file)))))
+
+(defun melpa2nix-install-from-buffer ()
+  "Install a package from the current buffer."
+  (let ((pkg-desc (if (derived-mode-p 'tar-mode)
+                      (package-tar-file-info)
+                    (package-buffer-info))))
+    ;; Install the package itself.
+    (package-unpack pkg-desc)
+    pkg-desc))
+
+(defun melpa2nix-install-file (file)
+  "Install a package from a file.
+The file can either be a tar file or an Emacs Lisp file."
+  (with-temp-buffer
+    (insert-file-contents-literally file)
+    (when (string-match "\\.tar\\'" file) (tar-mode))
+    (melpa2nix-install-from-buffer)))