3
0
Fork 0
forked from mirrors/nixpkgs

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
This commit is contained in:
Servilio Afre Puentes 2020-03-25 17:09:51 -04:00
parent 2607aae93f
commit b2c8626d61
2 changed files with 19 additions and 12 deletions

View file

@ -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;
}

View file

@ -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 =