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