I was getting the following error building tide from Melpa: nix-build -E '(import <nixpkgs> {}).emacs25WithPackages (p: [p.melpaPackages.tide])' File tide-20170509.1134.tar is large (10.2M), really open? (y or n) Error reading from stdin builder for ‘/nix/store/gs9ik7yf8iilsikkfing74i70m0diax3-emacs-tide-20170509.1134.drv’ failed with exit code 255 cannot build derivation ‘/nix/store/m3p080aani4rw82llp8nqk93cw2nvirk-emacs-with-packages-25.2.drv’: 1 dependencies couldn't be built Solution was to disable the large file warning threshold when installing packages.
34 lines
1.1 KiB
EmacsLisp
34 lines
1.1 KiB
EmacsLisp
(require 'package)
|
|
(package-initialize)
|
|
|
|
(defun elpa2nix-install-package ()
|
|
(if (not noninteractive)
|
|
(error "`elpa2nix-install-package' is to be used only with -batch"))
|
|
(pcase command-line-args-left
|
|
(`(,archive ,elpa)
|
|
(progn (setq package-user-dir elpa)
|
|
(elpa2nix-install-file archive)))))
|
|
|
|
(defun elpa2nix-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 elpa2nix-install-file (file)
|
|
"Install a package from a file.
|
|
The file can either be a tar file or an Emacs Lisp file."
|
|
(let ((is-tar (string-match "\\.tar\\'" file)))
|
|
(with-temp-buffer
|
|
(if is-tar
|
|
(insert-file-contents-literally file)
|
|
(insert-file-contents file))
|
|
(when is-tar (tar-mode))
|
|
(elpa2nix-install-from-buffer))))
|
|
|
|
;; Allow installing package tarfiles larger than 10MB
|
|
(setq large-file-warning-threshold nil)
|