2014-01-21 00:57:04 +01:00
|
|
|
# builder for Emacs packages built for packages.el
|
|
|
|
# using MELPA package-build.el
|
2015-02-18 00:06:27 +01:00
|
|
|
|
2014-01-21 00:57:04 +01:00
|
|
|
{ lib, stdenv, fetchurl, emacs, texinfo }:
|
|
|
|
|
|
|
|
with lib;
|
2015-02-18 00:06:27 +01:00
|
|
|
|
|
|
|
{ pname
|
|
|
|
, version
|
|
|
|
|
2015-12-29 20:23:49 +01:00
|
|
|
, recipeFile ? null
|
|
|
|
|
2015-02-18 00:06:27 +01:00
|
|
|
, files ? null
|
|
|
|
, fileSpecs ? [ "*.el" "*.el.in" "dir"
|
|
|
|
"*.info" "*.texi" "*.texinfo"
|
|
|
|
"doc/dir" "doc/*.info" "doc/*.texi" "doc/*.texinfo"
|
|
|
|
]
|
|
|
|
|
|
|
|
, meta ? {}
|
|
|
|
|
2014-01-21 00:57:04 +01:00
|
|
|
, ...
|
|
|
|
}@args:
|
2015-02-18 00:06:27 +01:00
|
|
|
|
|
|
|
let
|
|
|
|
|
2014-01-21 00:57:04 +01:00
|
|
|
packageBuild = fetchurl {
|
2015-12-27 17:37:02 +01:00
|
|
|
url = https://raw.githubusercontent.com/milkypostman/melpa/2b3eb31c077fcaff94b74b757c1ce17650333943/package-build.el;
|
|
|
|
sha256 = "1biwg2pqmmdz5iwqbjdszljazqymvgyyjcnc255nr6qz8mhnx67j";
|
2015-02-18 00:06:27 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
fname = "${pname}-${version}";
|
|
|
|
|
|
|
|
targets = concatStringsSep " " (if files == null then fileSpecs else files);
|
|
|
|
|
|
|
|
defaultMeta = {
|
2015-05-24 16:06:12 +02:00
|
|
|
homepage = args.src.meta.homepage or "http://melpa.org/#/${pname}";
|
2015-02-18 00:06:27 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
in
|
|
|
|
|
2014-01-21 00:57:04 +01:00
|
|
|
import ./generic.nix { inherit lib stdenv emacs texinfo; } ({
|
|
|
|
inherit packageBuild;
|
2015-02-18 00:06:27 +01:00
|
|
|
|
|
|
|
buildPhase = ''
|
|
|
|
runHook preBuild
|
|
|
|
|
|
|
|
emacs --batch -Q -l $packageBuild -l ${./melpa2nix.el} \
|
2015-12-29 20:23:49 +01:00
|
|
|
${if recipeFile == null
|
|
|
|
then
|
|
|
|
''
|
2015-02-18 00:06:27 +01:00
|
|
|
-f melpa2nix-build-package \
|
|
|
|
${pname} ${version} ${targets}
|
2015-12-29 20:23:49 +01:00
|
|
|
''
|
|
|
|
else
|
|
|
|
''
|
|
|
|
-f melpa2nix-build-package-from-recipe \
|
|
|
|
${pname} ${version} ${recipeFile}
|
|
|
|
''}
|
2015-02-18 00:06:27 +01:00
|
|
|
|
|
|
|
runHook postBuild
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
|
|
|
|
emacs --batch -Q -l $packageBuild -l ${./melpa2nix.el} \
|
|
|
|
-f melpa2nix-install-package \
|
|
|
|
${fname}.* $out/share/emacs/site-lisp/elpa
|
|
|
|
|
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = defaultMeta // meta;
|
|
|
|
}
|
|
|
|
|
2014-01-21 00:57:04 +01:00
|
|
|
// removeAttrs args [ "files" "fileSpecs"
|
|
|
|
"meta"
|
|
|
|
])
|