From b2c8626d618a8204ff6a5959653daec033e7362f Mon Sep 17 00:00:00 2001 From: Servilio Afre Puentes Date: Wed, 25 Mar 2020 17:09:51 -0400 Subject: [PATCH] emacs-modes: build MELPA package sets without null packages The current algorithm creates attributes with null values for packages with no source in a variant of MELPA. Though will satify dependencies they produce no files, and though a build that transitively depends on one them will be successful, Emacs won't find them and any code depending on them won't work. The solution with minimal code change would have been filtering the list of results from melpaDerivation by comparing the value against null, but that leads to an infinite recursion. This commit also moves legacy renames from the shared to the unstable set, as the corresponding null value elements won't exist in the stable set anymore. The test used for the problem was: $ nix-build --show-trace ./default.nix -A emacs26Packages.melpaStablePackages.findr error: expression does not evaluate to a derivation (or a set or list of those) The expected output, obtained with this commit is: $ nix-build --show-trace ./default.nix -A emacs26Packages.melpaStablePackages.findr error: attribute 'findr' in selection path 'emacs26Packages.melpaStablePackages.findr' not found --- .../editors/emacs-modes/libgenerated.nix | 9 +++++--- .../editors/emacs-modes/melpa-packages.nix | 22 +++++++++++-------- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/pkgs/applications/editors/emacs-modes/libgenerated.nix b/pkgs/applications/editors/emacs-modes/libgenerated.nix index 57bccc608183..d0c8b4565f57 100644 --- a/pkgs/applications/editors/emacs-modes/libgenerated.nix +++ b/pkgs/applications/editors/emacs-modes/libgenerated.nix @@ -61,8 +61,9 @@ in { pname = builtins.replaceStrings [ "@" ] [ "at" ] ename; broken = ! isNull error; in - lib.nameValuePair ename (if hasSource then ( - self.callPackage ({ melpaBuild, fetchurl, ... }@pkgargs: + if hasSource then + lib.nameValuePair ename ( + self.callPackage ({ melpaBuild, fetchurl, ... }@pkgargs: melpaBuild { inherit pname; ename = ename; @@ -85,6 +86,8 @@ in { }; } ) {} - ) else null); + ) + else + null; } diff --git a/pkgs/applications/editors/emacs-modes/melpa-packages.nix b/pkgs/applications/editors/emacs-modes/melpa-packages.nix index 5c9456b76a63..0dacb3173182 100644 --- a/pkgs/applications/editors/emacs-modes/melpa-packages.nix +++ b/pkgs/applications/editors/emacs-modes/melpa-packages.nix @@ -42,7 +42,9 @@ env NIXPKGS_ALLOW_BROKEN=1 nix-instantiate --show-trace ../../../../ -A emacsPac }: let inherit (import ./libgenerated.nix lib self) melpaDerivation; - super = lib.listToAttrs (map (melpaDerivation variant) (lib.importJSON archiveJson)); + super = lib.listToAttrs (builtins.filter (s: s != null) + (map (melpaDerivation variant) + (lib.importJSON archiveJson))); overrides = rec { shared = rec { @@ -268,10 +270,6 @@ env NIXPKGS_ALLOW_BROKEN=1 nix-instantiate --show-trace ../../../../ -A emacsPac # Map legacy renames from emacs2nix since code generation was ported to emacs lisp _0blayout = super."0blayout"; - _0xc = super."0xc"; - _2048-game = super."2048-game"; - _4clojure = super."4clojure"; - at = super."@"; desktop-plus = super."desktop+"; ghub-plus = super."ghub+"; git-gutter-plus = super."git-gutter+"; @@ -282,10 +280,6 @@ env NIXPKGS_ALLOW_BROKEN=1 nix-instantiate --show-trace ../../../../ -A emacsPac markdown-mode-plus = super."markdown-mode+"; package-plus = super."package+"; rect-plus = super."rect+"; - term-plus = super."term+"; - term-plus-key-intercept = super."term+key-intercept"; - term-plus-mux = super."term+mux"; - xml-plus = super."xml+"; }; stable = shared // { @@ -414,6 +408,16 @@ env NIXPKGS_ALLOW_BROKEN=1 nix-instantiate --show-trace ../../../../ -A emacsPac # Legacy alias emacs-libvterm = unstable.vterm; + # Map legacy renames from emacs2nix since code generation was ported to emacs lisp + _0xc = super."0xc"; + _2048-game = super."2048-game"; + _4clojure = super."4clojure"; + at = super."@"; + term-plus = super."term+"; + term-plus-key-intercept = super."term+key-intercept"; + term-plus-mux = super."term+mux"; + xml-plus = super."xml+"; + w3m = super.w3m.override (args: { melpaBuild = drv: args.melpaBuild (drv // { prePatch =