Error when trying to evluate "emacsWithPackages"

#266
Opened by hsjobeki at 2023-05-08T15·53+00

emacsWithPackages is a lambda. Get the following error when trying to evaluate the lambda: Strangely this is the only lambda directly in pkgs that fails to evaluate. (and emacs28WithPackages)

note: while evaluating this Nix code
   --> [code]:1:1
    |
1   | builtins.typeOf (import ./example.nix).emacsWithPackages
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: while evaluating this Nix code
   --> /nix/var/nix/profiles/per-user/root/channels/nixos/pkgs/top-level/aliases.nix:16:5
    |
16  | /     if isDerivation alias then
17  | |       dontDistribute alias
18  | |     else alias;
    | |______________^
note: while evaluating this as native code (force)
   --> /nix/var/nix/profiles/per-user/root/channels/nixos/pkgs/top-level/aliases.nix:16:8
    |
16  |     if isDerivation alias then
    |        ^^^^^^^^^^^^^^^^^^
note: while evaluating this Nix code
   --> /nix/var/nix/profiles/per-user/root/channels/nixos/lib/attrsets.nix:427:21
    |
427 |   isDerivation = x: x.type or null == "derivation";
    |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: while evaluating this as native code (force)
   --> /nix/var/nix/profiles/per-user/root/channels/nixos/lib/attrsets.nix:427:21
    |
427 |   isDerivation = x: x.type or null == "derivation";
    |                     ^^^^^^^^^^^^^^
note: while evaluating this as native code (force)
   --> /nix/var/nix/profiles/per-user/root/channels/nixos/lib/attrsets.nix:427:23
    |
427 |   isDerivation = x: x.type or null == "derivation";
    |                       ^^^^
note: while evaluating this Nix code
   --> /nix/var/nix/profiles/per-user/root/channels/nixos/pkgs/top-level/aliases.nix:9:5
    |
9   | /     if alias.recurseForDerivations or false
10  | |     then removeAttrs alias ["recurseForDerivations"]
11  | |     else alias;
    | |______________^
note: while evaluating this as native code (force)
   --> /nix/var/nix/profiles/per-user/root/channels/nixos/pkgs/top-level/aliases.nix:9:8
    |
9   |     if alias.recurseForDerivations or false
    |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: while evaluating this as native code (force)
   --> /nix/var/nix/profiles/per-user/root/channels/nixos/pkgs/top-level/aliases.nix:9:14
    |
9   |     if alias.recurseForDerivations or false
    |              ^^^^^^^^^^^^^^^^^^^^^
note: while evaluating this Nix code
   --> /nix/var/nix/profiles/per-user/root/channels/nixos/pkgs/top-level/aliases.nix:379:23
    |
379 |   emacsWithPackages = emacs.pkgs.withPackages; # Added 2020-12-18
    |                       ^^^^^^^^^^^^^^^^^^^^^^^
note: while evaluating this as native code (force)
   --> /nix/var/nix/profiles/per-user/root/channels/nixos/pkgs/top-level/aliases.nix:379:23
    |
379 |   emacsWithPackages = emacs.pkgs.withPackages; # Added 2020-12-18
    |                       ^^^^^
note: while evaluating this Nix code
   --> /nix/var/nix/profiles/per-user/root/channels/nixos/lib/attrsets.nix:623:12
    |
623 |     attrs: attrs // { recurseForDerivations = false; };
    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: while evaluating this as native code (force)
   --> /nix/var/nix/profiles/per-user/root/channels/nixos/lib/attrsets.nix:623:12
    |
623 |     attrs: attrs // { recurseForDerivations = false; };
    |            ^^^^^
note: while evaluating this Nix code
   --> /nix/var/nix/profiles/per-user/root/channels/nixos/lib/customisation.nix:256:16
    |
256 |       let self = f self // {
    |  ________________^
257 | |           newScope = scope: newScope (self // scope);
258 | |           callPackage = self.newScope {};
259 | |           overrideScope = g: lib.warn
...   |
263 | |           packages = f;
264 | |         };
    | |_________^
note: while evaluating this as native code (force)
   --> /nix/var/nix/profiles/per-user/root/channels/nixos/lib/customisation.nix:256:16
    |
256 |     let self = f self // {
    |                ^^^^^^
note: while evaluating this Nix code
   --> /nix/var/nix/profiles/per-user/root/channels/nixos/lib/customisation.nix:81:7
    |
81  | /       if builtins.isAttrs result then
82  | |         result // {
83  | |           override = overrideArgs;
84  | |           overrideDerivation = fdrv: overrideResult (x: overrideDerivation x fdrv);
...   |
92  | |         }
93  | |       else result;
    | |_________________^
note: while evaluating this as native code (force)
   --> /nix/var/nix/profiles/per-user/root/channels/nixos/lib/customisation.nix:81:10
    |
81  |       if builtins.isAttrs result then
    |          ^^^^^^^^^^^^^^^^^^^^^^^
note: while evaluating this Nix code
   --> /nix/var/nix/profiles/per-user/root/channels/nixos/pkgs/top-level/emacs-packages.nix:66:5
    |
66  |   }: ({}
    |  _____^
67  | |   // elpaPackages // { inherit elpaPackages; }
68  | |   // nongnuPackages // { inherit nongnuPackages; }
69  | |   // melpaStablePackages // { inherit melpaStablePackages; }
...   |
99  | |
100 | |   })
    | |___^
note: while evaluating this as native code (force)
   --> /nix/var/nix/profiles/per-user/root/channels/nixos/pkgs/top-level/emacs-packages.nix:67:6
    |
67  |     // elpaPackages // { inherit elpaPackages; }
    |  ______^
68  | |   // nongnuPackages // { inherit nongnuPackages; }
69  | |   // melpaStablePackages // { inherit melpaStablePackages; }
70  | |   // melpaPackages // { inherit melpaPackages; }
...   |
99  | |
100 | |   })
    | |___^
note: while evaluating this as native code (force)
   --> /nix/var/nix/profiles/per-user/root/channels/nixos/pkgs/top-level/emacs-packages.nix:67:22
    |
67  |     // elpaPackages // { inherit elpaPackages; }
    |  ______________________^
68  | |   // nongnuPackages // { inherit nongnuPackages; }
69  | |   // melpaStablePackages // { inherit melpaStablePackages; }
70  | |   // melpaPackages // { inherit melpaPackages; }
...   |
99  | |
100 | |   })
    | |___^
note: while evaluating this as native code (force)
   --> /nix/var/nix/profiles/per-user/root/channels/nixos/pkgs/top-level/emacs-packages.nix:68:6
    |
68  |     // nongnuPackages // { inherit nongnuPackages; }
    |  ______^
69  | |   // melpaStablePackages // { inherit melpaStablePackages; }
70  | |   // melpaPackages // { inherit melpaPackages; }
71  | |   // manualPackages // { inherit manualPackages; }
...   |
99  | |
100 | |   })
    | |___^
note: while evaluating this as native code (force)
   --> /nix/var/nix/profiles/per-user/root/channels/nixos/pkgs/top-level/emacs-packages.nix:68:24
    |
68  |     // nongnuPackages // { inherit nongnuPackages; }
    |  ________________________^
69  | |   // melpaStablePackages // { inherit melpaStablePackages; }
70  | |   // melpaPackages // { inherit melpaPackages; }
71  | |   // manualPackages // { inherit manualPackages; }
...   |
99  | |
100 | |   })
    | |___^
note: while evaluating this as native code (force)
   --> /nix/var/nix/profiles/per-user/root/channels/nixos/pkgs/top-level/emacs-packages.nix:69:6
    |
69  |     // melpaStablePackages // { inherit melpaStablePackages; }
    |  ______^
70  | |   // melpaPackages // { inherit melpaPackages; }
71  | |   // manualPackages // { inherit manualPackages; }
72  | |   // {
...   |
99  | |
100 | |   })
    | |___^
note: while evaluating this as native code (force)
   --> /nix/var/nix/profiles/per-user/root/channels/nixos/pkgs/top-level/emacs-packages.nix:69:6
    |
69  |   // melpaStablePackages // { inherit melpaStablePackages; }
    |      ^^^^^^^^^^^^^^^^^^^
note: while evaluating this Nix code
   --> /nix/var/nix/profiles/per-user/root/channels/nixos/lib/customisation.nix:81:7
    |
81  | /       if builtins.isAttrs result then
82  | |         result // {
83  | |           override = overrideArgs;
84  | |           overrideDerivation = fdrv: overrideResult (x: overrideDerivation x fdrv);
...   |
92  | |         }
93  | |       else result;
    | |_________________^
note: while evaluating this as native code (force)
   --> /nix/var/nix/profiles/per-user/root/channels/nixos/lib/customisation.nix:81:10
    |
81  |       if builtins.isAttrs result then
    |          ^^^^^^^^^^^^^^^^^^^^^^^
note: while evaluating this as native code (mapAttrs)
   --> /nix/var/nix/profiles/per-user/root/channels/nixos/pkgs/applications/editors/emacs/elisp-packages/melpa-packages.nix:565:8
    |
565 |     in lib.mapAttrs (n: v: if lib.hasAttr n overrides then overrides.${n} else v) super);
    |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: while evaluating this as native code (listToAttrs)
   --> /nix/var/nix/profiles/per-user/root/channels/nixos/pkgs/applications/editors/emacs/elisp-packages/melpa-packages.nix:65:9
    |
65  | /         lib.listToAttrs (builtins.filter
66  | |           (s: s != null)
67  | |           (map
68  | |             (melpaDerivation variant)
68  | |             (melpaDerivation variant)
70  | |           )
71  | |         )
    | |_________^
note: while evaluating this as native code (filter)
   --> /nix/var/nix/profiles/per-user/root/channels/nixos/pkgs/applications/editors/emacs/elisp-packages/melpa-packages.nix:65:26
    |
65  |           lib.listToAttrs (builtins.filter
    |  __________________________^
66  | |           (s: s != null)
67  | |           (map
68  | |             (melpaDerivation variant)
68  | |             (melpaDerivation variant)
70  | |           )
    | |___________^
note: while evaluating this Nix code
   --> /nix/var/nix/profiles/per-user/root/channels/nixos/pkgs/applications/editors/emacs/elisp-packages/melpa-packages.nix:66:15
    |
66  |           (s: s != null)
    |               ^^^^^^^^^
note: while evaluating this as native code (force)
   --> /nix/var/nix/profiles/per-user/root/channels/nixos/pkgs/applications/editors/emacs/elisp-packages/melpa-packages.nix:66:15
    |
66  |           (s: s != null)
    |               ^
note: while evaluating this Nix code
   --> /nix/var/nix/profiles/per-user/root/channels/nixos/pkgs/applications/editors/emacs/elisp-packages/libgenerated.nix:69:7
    |
69  | /       let
70  | |         sourceArgs = args.${variant};
71  | |         version = sourceArgs.version or null;
72  | |         deps = sourceArgs.deps or null;
...   |
106 | |     else
107 | |       null;
    | |__________^
note: while evaluating this as native code (force)
   --> /nix/var/nix/profiles/per-user/root/channels/nixos/pkgs/applications/editors/emacs/elisp-packages/libgenerated.nix:76:18
    |
76  |         broken = ! isNull error;
    |                  ^^^^^^^^^^^^^^
note: while evaluating this as native code (isNull)
   --> /nix/var/nix/profiles/per-user/root/channels/nixos/pkgs/applications/editors/emacs/elisp-packages/libgenerated.nix:76:20
    |
76  |         broken = ! isNull error;
    |                    ^^^^^^^^^^^^
note: while evaluating this Nix code
   --> /nix/var/nix/profiles/per-user/root/channels/nixos/pkgs/applications/editors/emacs/elisp-packages/libgenerated.nix:73:17
    |
73  |         error = sourceArgs.error or args.error or null;
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: while evaluating this as native code (force)
   --> /nix/var/nix/profiles/per-user/root/channels/nixos/pkgs/applications/editors/emacs/elisp-packages/libgenerated.nix:73:28
    |
73  |         error = sourceArgs.error or args.error or null;
    |                            ^^^^^
error[E005]: attribute with name 'stable' could not be found in the set
   --> /nix/var/nix/profiles/per-user/root/channels/nixos/pkgs/applications/editors/emacs/elisp-packages/libgenerated.nix:70:27
    |
70  |         sourceArgs = args.${variant};
    |                           ^^^^^^^^^^

Expected result:

nix-repl> pkgs.emacsWithPackages
«lambda @ /nix/store/ialjhdml02pqagrwls4g4ywbp2kdrff6-nixos-22.05/nixos/pkgs/build-support/emacs/wrapper.nix:47:1»

The nix repl shows that its a lambda.

  1. hsjobeki updated the body of this issue at 2023-05-08T15·55+00
  2. I can no longer reproduce this on r/6206 and nixpkgs 92f37aaa8af1cc8948c469d863c20b969688184b. Can you retry?

    sterni at 2023-05-26T13·56+00