nixpkgs/pkgs/applications/editors/emacs-modes/elpa-packages.nix

55 lines
1.4 KiB
Nix
Raw Normal View History

2015-12-06 15:27:19 +00:00
pkgs: with pkgs;
let
inherit (stdenv.lib) makeScope mapAttrs;
json = builtins.readFile ./elpa-packages.json;
manifest = builtins.fromJSON json;
mkPackage = self: name: recipe:
let drv =
{ elpaBuild, stdenv, fetchurl }:
2015-12-15 17:57:51 +00:00
let
unknownFetcher =
abort "emacs-${name}: unknown fetcher '${recipe.fetch.tag}'";
fetch =
{ inherit fetchurl; }."${recipe.fetch.tag}"
or unknownFetcher;
args = builtins.removeAttrs recipe.fetch [ "tag" ];
src = fetch args;
2015-12-06 15:27:19 +00:00
in elpaBuild {
pname = name;
inherit (recipe) version;
inherit src;
deps =
2015-12-15 17:57:51 +00:00
let lookupDep = d: self."${d}" or null;
2015-12-06 15:27:19 +00:00
in map lookupDep recipe.deps;
meta = {
homepage = "http://elpa.gnu.org/packages/${name}.html";
license = stdenv.lib.licenses.free;
};
};
in self.callPackage drv {};
2015-12-15 17:57:51 +00:00
in
2015-12-06 15:27:19 +00:00
2015-12-15 17:57:51 +00:00
self:
2015-12-06 15:27:19 +00:00
2015-12-15 17:57:51 +00:00
let
super = mapAttrs (mkPackage self) manifest;
elpaBuild = import ../../../build-support/emacs/melpa.nix {
inherit (pkgs) lib stdenv fetchurl texinfo;
inherit (self) emacs;
};
builtin = null;
markBroken = pkg: pkg.override {
elpaBuild = args: self.elpaBuild (args // {
meta = (args.meta or {}) // { broken = true; };
});
};
in super // { inherit elpaBuild; elpaPackage = super; }