From 8e655250bdde40150f0c8c059f6d8f5483805dec Mon Sep 17 00:00:00 2001 From: Thomas Tuegel Date: Tue, 15 Dec 2015 11:57:51 -0600 Subject: [PATCH] emacsPackagesNg: add all of MELPA --- .../editors/emacs-modes/elpa-packages.nix | 42 ++++++++++++------- .../editors/emacs-modes/melpa-packages.nix | 40 +++++++++++------- .../emacs-modes/melpa-stable-packages.nix | 40 +++++++++++------- pkgs/top-level/all-packages.nix | 12 ++++-- pkgs/top-level/emacs-packages.nix | 22 +++++++--- 5 files changed, 101 insertions(+), 55 deletions(-) diff --git a/pkgs/applications/editors/emacs-modes/elpa-packages.nix b/pkgs/applications/editors/emacs-modes/elpa-packages.nix index 3cf37c262806..6c48969a9ef5 100644 --- a/pkgs/applications/editors/emacs-modes/elpa-packages.nix +++ b/pkgs/applications/editors/emacs-modes/elpa-packages.nix @@ -10,17 +10,20 @@ let 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; + 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; in elpaBuild { pname = name; inherit (recipe) version; inherit src; deps = - let lookupDep = d: - self."${d}" or (abort "emacs-${name}: missing dependency ${d}"); + let lookupDep = d: self."${d}" or null; in map lookupDep recipe.deps; meta = { homepage = "http://elpa.gnu.org/packages/${name}.html"; @@ -29,14 +32,23 @@ let }; in self.callPackage drv {}; - packages = self: - let - elpaPackages = mapAttrs (mkPackage self) manifest; +in - elpaBuild = import ../../../build-support/emacs/melpa.nix { - inherit (pkgs) lib stdenv fetchurl texinfo; - inherit (self) emacs; - }; - in elpaPackages // { inherit elpaBuild elpaPackages; }; +self: -in makeScope pkgs.newScope packages + 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; } diff --git a/pkgs/applications/editors/emacs-modes/melpa-packages.nix b/pkgs/applications/editors/emacs-modes/melpa-packages.nix index e2afe27058a7..1bc4363cb11c 100644 --- a/pkgs/applications/editors/emacs-modes/melpa-packages.nix +++ b/pkgs/applications/editors/emacs-modes/melpa-packages.nix @@ -9,18 +9,23 @@ let mkPackage = self: name: recipe: let drv = - { melpaBuild, 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; + { melpaBuild, stdenv, fetchurl, fetchcvs, fetchgit, fetchhg }: + let + unknownFetcher = + abort "emacs-${name}: unknown fetcher '${recipe.fetch.tag}'"; + fetch = + { + inherit fetchurl fetchcvs fetchgit fetchhg; + }."${recipe.fetch.tag}" + or unknownFetcher; + args = builtins.removeAttrs recipe.fetch [ "tag" ]; + src = fetch args; in melpaBuild { pname = name; inherit (recipe) version; inherit src; deps = - let lookupDep = d: - self."${d}" or (abort "emacs-${name}: missing dependency ${d}"); + let lookupDep = d: self."${d}" or null; in map lookupDep recipe.deps; meta = { homepage = "http://melpa.org/#/${name}"; @@ -29,14 +34,17 @@ let }; in self.callPackage drv {}; - packages = self: - let - melpaPackages = mapAttrs (mkPackage self) manifest; +in - melpaBuild = import ../../../build-support/emacs/melpa.nix { - inherit (pkgs) lib stdenv fetchurl texinfo; - inherit (self) emacs; - }; - in melpaPackages // { inherit melpaBuild melpaPackages; }; +self: -in makeScope pkgs.newScope packages + let + super = mapAttrs (mkPackage self) manifest; + + markBroken = pkg: pkg.override { + melpaBuild = args: self.melpaBuild (args // { + meta = (args.meta or {}) // { broken = true; }; + }); + }; + in + super // { melpaPackages = super; } diff --git a/pkgs/applications/editors/emacs-modes/melpa-stable-packages.nix b/pkgs/applications/editors/emacs-modes/melpa-stable-packages.nix index b17bda56c28d..869c5549bfa6 100644 --- a/pkgs/applications/editors/emacs-modes/melpa-stable-packages.nix +++ b/pkgs/applications/editors/emacs-modes/melpa-stable-packages.nix @@ -9,18 +9,23 @@ let mkPackage = self: name: recipe: let drv = - { melpaBuild, 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; + { melpaBuild, stdenv, fetchurl, fetchcvs, fetchgit, fetchhg }: + let + unknownFetcher = + abort "emacs-${name}: unknown fetcher '${recipe.fetch.tag}'"; + fetch = + { + inherit fetchurl fetchcvs fetchgit fetchhg; + }."${recipe.fetch.tag}" + or unknownFetcher; + args = builtins.removeAttrs recipe.fetch [ "tag" ]; + src = fetch args; in melpaBuild { pname = name; inherit (recipe) version; inherit src; deps = - let lookupDep = d: - self."${d}" or (abort "emacs-${name}: missing dependency ${d}"); + let lookupDep = d: self."${d}" or null; in map lookupDep recipe.deps; meta = { homepage = "http://stable.melpa.org/#/${name}"; @@ -29,14 +34,17 @@ let }; in self.callPackage drv {}; - packages = self: - let - melpaStablePackages = mapAttrs (mkPackage self) manifest; +in - melpaBuild = import ../../../build-support/emacs/melpa.nix { - inherit (pkgs) lib stdenv fetchurl texinfo; - inherit (self) emacs; - }; - in melpaStablePackages // { inherit melpaBuild melpaStablePackages; }; +self: -in makeScope pkgs.newScope packages + let + super = mapAttrs (mkPackage self) manifest; + + markBroken = pkg: pkg.override { + melpaBuild = args: self.melpaBuild (args // { + meta = (args.meta or {}) // { broken = true; }; + }); + }; + in + super // { melpaStablePackages = super; } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 1877617f0165..012b7225831d 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -11627,7 +11627,8 @@ let emacsPackagesNgGen = emacs: callPackage ./emacs-packages.nix { overrides = (config.emacsPackageOverrides or (p: {})) pkgs; - inherit emacs elpaPackages; + inherit newScope; + inherit emacs elpaPackages melpaPackages melpaStablePackages; trivialBuild = callPackage ../build-support/emacs/trivial.nix { inherit emacs; @@ -11647,8 +11648,13 @@ let emacs24PackagesNg = recurseIntoAttrs (emacsPackagesNgGen emacs24); elpaPackages = - let imported = import ../applications/editors/emacs-modes/elpa-packages.nix pkgs; - in recurseIntoAttrs (imported.override (super: self: { inherit emacs; })); + import ../applications/editors/emacs-modes/elpa-packages.nix pkgs; + + melpaStablePackages = + import ../applications/editors/emacs-modes/melpa-stable-packages.nix pkgs; + + melpaPackages = + import ../applications/editors/emacs-modes/melpa-packages.nix pkgs; emacsWithPackages = callPackage ../build-support/emacs/wrapper.nix { }; emacs24WithPackages = emacsWithPackages.override { emacs = emacs24; }; diff --git a/pkgs/top-level/emacs-packages.nix b/pkgs/top-level/emacs-packages.nix index 2acb4cbbe0be..ebd6464de5a1 100644 --- a/pkgs/top-level/emacs-packages.nix +++ b/pkgs/top-level/emacs-packages.nix @@ -33,9 +33,9 @@ { overrides -, lib, stdenv, fetchurl, fetchgit, fetchFromGitHub, fetchhg +, lib, newScope, stdenv, fetchurl, fetchgit, fetchFromGitHub, fetchhg -, emacs, elpaPackages +, emacs, elpaPackages, melpaPackages, melpaStablePackages , trivialBuild , melpaBuild @@ -44,7 +44,14 @@ with lib.licenses; -let packagesFun = super: self: with self; { +let + + addMelpaPackages = scope: scope.override (super: melpaPackages); + addMelpaStablePackages = scope: scope.override (super: melpaStablePackages); + addElpaPackages = scope: scope.override (super: elpaPackages); + addOverrides = scope: scope.override packagesFun; + + packagesFun = super: self: with self; { inherit emacs melpaBuild trivialBuild; @@ -2019,6 +2026,11 @@ let packagesFun = super: self: with self; { }; }; -}; + }; -in elpaPackages.override packagesFun +in + addOverrides + (addElpaPackages + (addMelpaStablePackages + (addMelpaPackages + (lib.makeScope newScope (self: { inherit emacs; })))))