diff options
author | Thomas Tuegel <ttuegel@mailbox.org> | 2018-07-15 20:52:41 -0500 |
---|---|---|
committer | Thomas Tuegel <ttuegel@mailbox.org> | 2018-07-15 20:52:41 -0500 |
commit | d3cea4860862754d74f60a4332c24b646f1446c9 (patch) | |
tree | a472bca6e56caa71d320dea8812ce0f3edc6f4e0 /pkgs/build-support/emacs | |
parent | dae9cf6106da19f79a39714f183ed253c62b32c5 (diff) | |
download | nixpkgs-d3cea4860862754d74f60a4332c24b646f1446c9.tar nixpkgs-d3cea4860862754d74f60a4332c24b646f1446c9.tar.gz nixpkgs-d3cea4860862754d74f60a4332c24b646f1446c9.tar.bz2 nixpkgs-d3cea4860862754d74f60a4332c24b646f1446c9.tar.lz nixpkgs-d3cea4860862754d74f60a4332c24b646f1446c9.tar.xz nixpkgs-d3cea4860862754d74f60a4332c24b646f1446c9.tar.zst nixpkgs-d3cea4860862754d74f60a4332c24b646f1446c9.zip |
emacsPackagesNg: 2018-07-15 update
All package sets are simultaneously updated to accommodate changes to package-build. Due to new restrictions in package-build, all packages using `melpaBuild` must now provide a recipe file, even those packages which are not included in upstream MELPA.
Diffstat (limited to 'pkgs/build-support/emacs')
-rw-r--r-- | pkgs/build-support/emacs/melpa.nix | 85 | ||||
-rw-r--r-- | pkgs/build-support/emacs/melpa2nix.el | 38 |
2 files changed, 52 insertions, 71 deletions
diff --git a/pkgs/build-support/emacs/melpa.nix b/pkgs/build-support/emacs/melpa.nix index 3b8a23d8c2a..f55c91f82c7 100644 --- a/pkgs/build-support/emacs/melpa.nix +++ b/pkgs/build-support/emacs/melpa.nix @@ -1,35 +1,19 @@ # builder for Emacs packages built for packages.el # using MELPA package-build.el -{ lib, stdenv, fetchurl, emacs, texinfo }: +{ lib, stdenv, fetchurl, fetchFromGitHub, emacs, texinfo }: with lib; { pname , version - -, recipeFile ? null - -, files ? null -, fileSpecs ? [ "*.el" "*.el.in" "dir" - "*.info" "*.texi" "*.texinfo" - "doc/dir" "doc/*.info" "doc/*.texi" "doc/*.texinfo" - ] - +, recipe , meta ? {} - , ... }@args: let - packageBuild = fetchurl { - url = https://raw.githubusercontent.com/milkypostman/melpa/2b3eb31c077fcaff94b74b757c1ce17650333943/package-build.el; - sha256 = "1biwg2pqmmdz5iwqbjdszljazqymvgyyjcnc255nr6qz8mhnx67j"; - }; - - targets = concatStringsSep " " (if files == null then fileSpecs else files); - defaultMeta = { homepage = args.src.meta.homepage or "http://melpa.org/#/${pname}"; }; @@ -37,33 +21,58 @@ let in import ./generic.nix { inherit lib stdenv emacs texinfo; } ({ - inherit packageBuild; - buildPhase = - if recipeFile == null - then '' - runHook preBuild + melpa = fetchFromGitHub { + owner = "melpa"; + repo = "melpa"; + rev = "7103313a7c31bb1ebb71419e365cd2e279ee4609"; + sha256 = "0m10f83ix0mzjk0vjd4kkb1m1p4b8ha0ll2yjsgk9bqjd7fwapqb"; + }; - export archive=$(emacs --batch -Q -l $packageBuild -l ${./melpa2nix.el} \ - -f melpa2nix-build-package \ - ${pname} ${version} ${targets}) + elpa2nix = ./elpa2nix.el; + melpa2nix = ./melpa2nix.el; - runHook postBuild - '' - else '' - runHook preBuild + preUnpack = '' + mkdir -p "$NIX_BUILD_TOP/recipes" + if [ -n "$recipe" ]; then + cp "$recipe" "$NIX_BUILD_TOP/recipes/$pname" + fi - export archive=$(emacs --batch -Q -l $packageBuild -l ${./melpa2nix.el} \ - -f melpa2nix-build-package-from-recipe \ - ${recipeFile} ${version}) + ln -s "$melpa/package-build" "$NIX_BUILD_TOP/package-build" - runHook postBuild - ''; + mkdir -p "$NIX_BUILD_TOP/packages" + ''; + + postUnpack = '' + mkdir -p "$NIX_BUILD_TOP/working" + ln -s "$NIX_BUILD_TOP/$sourceRoot" "$NIX_BUILD_TOP/working/$pname" + ''; + + buildPhase = + '' + runHook preBuild + + cd "$NIX_BUILD_TOP" + + emacs --batch -Q \ + -L "$melpa/package-build" \ + -l "$melpa2nix" \ + -f melpa2nix-build-package \ + $pname $version + + runHook postBuild + ''; installPhase = '' runHook preInstall - emacs --batch -Q -l ${./elpa2nix.el} \ + archive="$NIX_BUILD_TOP/packages/$pname-$version.el" + if [ ! -f "$archive" ]; then + archive="$NIX_BUILD_TOP/packages/$pname-$version.tar" + fi + + emacs --batch -Q \ + -l "$elpa2nix" \ -f elpa2nix-install-package \ "$archive" "$out/share/emacs/site-lisp/elpa" @@ -73,6 +82,4 @@ import ./generic.nix { inherit lib stdenv emacs texinfo; } ({ meta = defaultMeta // meta; } -// removeAttrs args [ "files" "fileSpecs" - "meta" - ]) +// removeAttrs args [ "meta" ]) diff --git a/pkgs/build-support/emacs/melpa2nix.el b/pkgs/build-support/emacs/melpa2nix.el index 3cd5bbdb954..99c755e2afc 100644 --- a/pkgs/build-support/emacs/melpa2nix.el +++ b/pkgs/build-support/emacs/melpa2nix.el @@ -1,42 +1,16 @@ (require 'package) (package-initialize) +(require 'package-recipe) (require 'package-build) -(setq package-build-working-dir (expand-file-name ".") - package-build-archive-dir (expand-file-name ".")) +(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/")) (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-build-package-from-recipe () - (if (not noninteractive) - (error "`melpa2nix-build-package' is to be used only with -batch")) - (pcase command-line-args-left - (`(,recipe-file ,version) - (let* ((recipe (package-build--read-from-file recipe-file)) - (rcp (cdr recipe)) - (package (car recipe)) - (files (package-build--config-file-list rcp))) - (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)) - (archive-file (package-build--archive-file-name archive-entry))) - - (progn - (package-build--message "Built in %.3fs, finished at %s" - (time-to-seconds (time-since start-time)) - (current-time-string)) - (princ (format "%s\n" archive-file))))) + (`(,package ,version) + (package-build--package (package-recipe-lookup package) version)))) |