1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-24 06:31:02 +00:00
nixpkgs/pkgs/build-support/emacs/melpa2nix.el
2015-12-27 10:59:27 -06:00

37 lines
1.4 KiB
EmacsLisp

(require 'package)
(package-initialize)
(require 'package-build)
(setq package-build-working-dir (expand-file-name ".")
package-build-archive-dir (expand-file-name "."))
(defun melpa2nix-install-package ()
(if (not noninteractive)
(error "`melpa2nix-install-package' is to be used only with -batch"))
(pcase command-line-args-left
(`(,archive ,elpa)
(progn (setq package-user-dir elpa)
(package-install-file archive)))))
(defun melpa2nix-build-package ()
(if (not noninteractive)
(error "`melpa2nix-build-package' is to be used only with -batch"))
(pcase command-line-args-left
(`(,package ,version . ,files)
(melpa2nix-package-build-archive package version files))))
(defun melpa2nix-package-build-archive (name version files)
"Build a package archive for package NAME."
(package-build--message "\n;;; %s\n" name)
(let* ((start-time (current-time))
(archive-entry (package-build-package name
version
files
package-build-working-dir
package-build-archive-dir)))
(package-build--message "Built in %.3fs, finished at %s"
(time-to-seconds (time-since start-time))
(current-time-string))))