2015-02-09 03:29:48 +03:00
|
|
|
(require 'package)
|
|
|
|
(package-initialize)
|
|
|
|
|
2018-07-16 04:52:41 +03:00
|
|
|
(require 'package-recipe)
|
2015-02-09 03:29:48 +03:00
|
|
|
(require 'package-build)
|
|
|
|
|
2018-07-16 04:52:41 +03:00
|
|
|
(setq package-build-working-dir (expand-file-name "working/"))
|
|
|
|
(setq package-build-archive-dir (expand-file-name "packages/"))
|
|
|
|
(setq package-build-recipes-dir (expand-file-name "recipes/"))
|
2015-02-09 03:29:48 +03:00
|
|
|
|
2021-12-19 19:07:18 +03:00
|
|
|
;; Allow installing package tarfiles larger than 10MB
|
|
|
|
(setq large-file-warning-threshold nil)
|
|
|
|
|
2022-05-23 22:52:17 +03:00
|
|
|
(defun melpa2nix-build-package-1 (rcp version commit)
|
|
|
|
(let ((source-dir (package-recipe--working-tree rcp)))
|
|
|
|
(unwind-protect
|
|
|
|
(let ((files (package-build-expand-files-spec rcp t)))
|
|
|
|
(cond
|
|
|
|
((= (length files) 1)
|
|
|
|
(package-build--build-single-file-package
|
|
|
|
rcp version commit files source-dir))
|
|
|
|
((> (length files) 1)
|
|
|
|
(package-build--build-multi-file-package
|
|
|
|
rcp version commit files source-dir))
|
|
|
|
(t (error "Unable to find files matching recipe patterns")))))))
|
|
|
|
|
2015-02-09 03:29:48 +03:00
|
|
|
(defun melpa2nix-build-package ()
|
|
|
|
(if (not noninteractive)
|
|
|
|
(error "`melpa2nix-build-package' is to be used only with -batch"))
|
|
|
|
(pcase command-line-args-left
|
2021-07-06 18:52:13 +03:00
|
|
|
(`(,package ,version ,commit)
|
2022-05-23 22:52:17 +03:00
|
|
|
(melpa2nix-build-package-1 (package-recipe-lookup package) version commit))))
|