From 0c2259629d8a6e28c1552a8554cdd013a97ab87c Mon Sep 17 00:00:00 2001 From: Thomas Tuegel Date: Sun, 6 Dec 2015 09:27:19 -0600 Subject: [PATCH] add elpa-packages.nix --- .../editors/emacs-modes/elpa-packages.nix | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 pkgs/applications/editors/emacs-modes/elpa-packages.nix diff --git a/pkgs/applications/editors/emacs-modes/elpa-packages.nix b/pkgs/applications/editors/emacs-modes/elpa-packages.nix new file mode 100644 index 000000000000..3cf37c262806 --- /dev/null +++ b/pkgs/applications/editors/emacs-modes/elpa-packages.nix @@ -0,0 +1,42 @@ +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 }: + let fetch = { inherit fetchurl; }."${recipe.fetch.tag}" + or (abort "emacs-${name}: unknown fetcher '${recipe.fetch.tag}'"); + args = builtins.removeAttrs recipe.fetch [ "tag" ]; + src = fetch args; + in elpaBuild { + pname = name; + inherit (recipe) version; + inherit src; + deps = + let lookupDep = d: + self."${d}" or (abort "emacs-${name}: missing dependency ${d}"); + in map lookupDep recipe.deps; + meta = { + homepage = "http://elpa.gnu.org/packages/${name}.html"; + license = stdenv.lib.licenses.free; + }; + }; + in self.callPackage drv {}; + + packages = self: + let + elpaPackages = mapAttrs (mkPackage self) manifest; + + elpaBuild = import ../../../build-support/emacs/melpa.nix { + inherit (pkgs) lib stdenv fetchurl texinfo; + inherit (self) emacs; + }; + in elpaPackages // { inherit elpaBuild elpaPackages; }; + +in makeScope pkgs.newScope packages