Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"error: attribute 'definitionsWithLocations' missing" after nix-channel --update #849

Closed
pasviegas opened this issue Jan 14, 2024 · 5 comments

Comments

@pasviegas
Copy link

Hi! I am getting this error:

error: attribute 'definitionsWithLocations' missing

       at /nix/store/41214fy184211h1qn4i1pw0a5vhasnwd-darwin/darwin/modules/nix/nixpkgs.nix:34:17:

           33|                 )
           34|                 opt.definitionsWithLocations
             |                 ^
           35|             )

When doing a "darwin-rebuild switch" after a "nix-channel --update darwin".

I am not sure what to change in my config to fix. Thanks in advance.

@timsears
Copy link

experiencing a similar error after a nix flake update and then darwin-rebuld.

@awseward
Copy link
Contributor

Also experiencing this when I run my usual nix-channel --update --verbose && darwin-rebuild switch.

Admittedly I'm not nearly familiar enough with nix to expect to have much luck troubleshooting this, but here's the full output from adding --show-trace:

Full output
building the system configuration...
error: attribute 'definitionsWithLocations' missing

       at /nix/store/z22a2sgyx63sl1hc485rcvncfch163ja-darwin/darwin/modules/nix/nixpkgs.nix:34:17:

           33|                 )
           34|                 opt.definitionsWithLocations
             |                 ^
           35|             )

       … while evaluating anonymous lambda

       at /nix/store/z22a2sgyx63sl1hc485rcvncfch163ja-darwin/darwin/modules/nix/nixpkgs.nix:12:71:

           11|   # Backport from Nixpkgs 23.11
           12|   mergeAttrDefinitionsWithPrio = lib.mergeAttrDefinitionsWithPrio or (opt:
             |                                                                       ^
           13|     let

       … from call site

       at /nix/store/z22a2sgyx63sl1hc485rcvncfch163ja-darwin/darwin/modules/nix/nixpkgs.nix:320:8:

          319|       # pkgs module argument has that priority, it's from us.
          320|       (mergeAttrDefinitionsWithPrio options._module.args).pkgs.highestPrio
             |        ^
          321|         == defaultOverridePriority

       … while evaluating the attribute 'value'

       at /nix/store/jas3z51rakibqdhmihh895gnzndzhd1s-nixpkgs-22.05.4694.380be19fbd2d/nixpkgs/lib/modules.nix:581:44:

          580|       defnsByName' = byName "config" (module: value:
          581|           [{ inherit (module) file; inherit value; }]
             |                                            ^
          582|         ) configs;

       … while evaluating 'dischargeProperties'

       at /nix/store/jas3z51rakibqdhmihh895gnzndzhd1s-nixpkgs-22.05.4694.380be19fbd2d/nixpkgs/lib/modules.nix:832:25:

          831|   */
          832|   dischargeProperties = def:
             |                         ^
          833|     if def._type or "" == "merge" then

       … from call site

       at /nix/store/jas3z51rakibqdhmihh895gnzndzhd1s-nixpkgs-22.05.4694.380be19fbd2d/nixpkgs/lib/modules.nix:761:137:

          760|         defs' = concatMap (m:
          761|           map (value: { inherit (m) file; inherit value; }) (builtins.addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))
             |                                                                                                                                         ^
          762|         ) defs;

       … while evaluating definitions from `/nix/store/z22a2sgyx63sl1hc485rcvncfch163ja-darwin/darwin/modules/nix/nixpkgs.nix':

       … while evaluating anonymous lambda

       at /nix/store/jas3z51rakibqdhmihh895gnzndzhd1s-nixpkgs-22.05.4694.380be19fbd2d/nixpkgs/lib/modules.nix:760:28:

          759|         # Process mkMerge and mkIf properties.
          760|         defs' = concatMap (m:
             |                            ^
          761|           map (value: { inherit (m) file; inherit value; }) (builtins.addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))

       … from call site

       at /nix/store/jas3z51rakibqdhmihh895gnzndzhd1s-nixpkgs-22.05.4694.380be19fbd2d/nixpkgs/lib/modules.nix:760:17:

          759|         # Process mkMerge and mkIf properties.
          760|         defs' = concatMap (m:
             |                 ^
          761|           map (value: { inherit (m) file; inherit value; }) (builtins.addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))

       … while evaluating the attribute 'values'

       at /nix/store/jas3z51rakibqdhmihh895gnzndzhd1s-nixpkgs-22.05.4694.380be19fbd2d/nixpkgs/lib/modules.nix:873:7:

          872|     in {
          873|       values = concatMap (def: if getPrio def == highestPrio then [(strip def)] else []) defs;
             |       ^
          874|       inherit highestPrio;

       … while evaluating the attribute 'values'

       at /nix/store/jas3z51rakibqdhmihh895gnzndzhd1s-nixpkgs-22.05.4694.380be19fbd2d/nixpkgs/lib/modules.nix:774:9:

          773|       in {
          774|         values = defs''';
             |         ^
          775|         inherit (defs'') highestPrio;

       … while evaluating the attribute 'mergedValue'

       at /nix/store/jas3z51rakibqdhmihh895gnzndzhd1s-nixpkgs-22.05.4694.380be19fbd2d/nixpkgs/lib/modules.nix:780:5:

          779|     # Type-check the remaining definitions, and merge them. Or throw if no definitions.
          780|     mergedValue =
             |     ^
          781|       if isDefined then

       … while evaluating the option `nixpkgs.constructedByUs':

       … while evaluating the attribute 'value'

       at /nix/store/jas3z51rakibqdhmihh895gnzndzhd1s-nixpkgs-22.05.4694.380be19fbd2d/nixpkgs/lib/modules.nix:746:9:

          745|     in warnDeprecation opt //
          746|       { value = builtins.addErrorContext "while evaluating the option `${showOption loc}':" value;
             |         ^
          747|         inherit (res.defsFinal') highestPrio;

       … while evaluating anonymous lambda

       at /nix/store/jas3z51rakibqdhmihh895gnzndzhd1s-nixpkgs-22.05.4694.380be19fbd2d/nixpkgs/lib/modules.nix:296:72:

          295|           # For definitions that have an associated option
          296|           declaredConfig = mapAttrsRecursiveCond (v: ! isOption v) (_: v: v.value) options;
             |                                                                        ^
          297|

       … from call site

       at /nix/store/jas3z51rakibqdhmihh895gnzndzhd1s-nixpkgs-22.05.4694.380be19fbd2d/nixpkgs/lib/attrsets.nix:401:20:

          400|               then recurse (path ++ [name]) value
          401|               else f (path ++ [name]) value;
             |                    ^
          402|         in mapAttrs g;

       … while evaluating 'g'

       at /nix/store/jas3z51rakibqdhmihh895gnzndzhd1s-nixpkgs-22.05.4694.380be19fbd2d/nixpkgs/lib/attrsets.nix:398:19:

          397|           g =
          398|             name: value:
             |                   ^
          399|             if isAttrs value && cond value

       … from call site

       … while evaluating the attribute 'assertion'

       at /nix/store/z22a2sgyx63sl1hc485rcvncfch163ja-darwin/darwin/modules/nix/nixpkgs.nix:330:11:

          329|         in {
          330|           assertion = cfg.constructedByUs -> !hasPlatform -> cfg.system == pkgsSystem;
             |           ^
          331|           message = "The nix-darwin nixpkgs.pkgs option was set to a Nixpkgs invocation that compiles to target system ${pkgsSystem} but nix-darwin was configured for system ${darwinExpectedSystem} via nix-darwin option nixpkgs.system. The nix-darwin system settings must match the Nixpkgs target system.";

       … while evaluating anonymous lambda

       at /nix/store/z22a2sgyx63sl1hc485rcvncfch163ja-darwin/darwin/modules/system/default.nix:11:50:

           10|
           11|   failedAssertions = map (x: x.message) (filter (x: !x.assertion) config.assertions);
             |                                                  ^
           12|

       … from call site

       … while evaluating 'throwAssertions'

       at /nix/store/z22a2sgyx63sl1hc485rcvncfch163ja-darwin/darwin/modules/system/default.nix:13:21:

           12|
           13|   throwAssertions = res: if (failedAssertions != []) then throw "\nFailed assertions:\n${concatStringsSep "\n" (map (x: "- ${x}") failedAssertions)}" else res;
             |                     ^
           14|   showWarnings = res: fold (w: x: builtins.trace "warning: ${w}" x) res config.warnings;

       … from call site

       at /nix/store/z22a2sgyx63sl1hc485rcvncfch163ja-darwin/darwin/modules/system/default.nix:91:29:

           90|
           91|     system.build.toplevel = throwAssertions (showWarnings (stdenvNoCC.mkDerivation ({
             |                             ^
           92|       name = "darwin-system-${cfg.darwinLabel}";

       … while evaluating the attribute 'value'

       at /nix/store/jas3z51rakibqdhmihh895gnzndzhd1s-nixpkgs-22.05.4694.380be19fbd2d/nixpkgs/lib/types.nix:436:60:

          435|           # Push down position info.
          436|           (map (def: mapAttrs (n: v: { inherit (def) file; value = v; }) def.value) defs)));
             |                                                            ^
          437|       emptyValue = { value = {}; };

       … while evaluating 'dischargeProperties'

       at /nix/store/jas3z51rakibqdhmihh895gnzndzhd1s-nixpkgs-22.05.4694.380be19fbd2d/nixpkgs/lib/modules.nix:832:25:

          831|   */
          832|   dischargeProperties = def:
             |                         ^
          833|     if def._type or "" == "merge" then

       … from call site

       at /nix/store/jas3z51rakibqdhmihh895gnzndzhd1s-nixpkgs-22.05.4694.380be19fbd2d/nixpkgs/lib/modules.nix:761:137:

          760|         defs' = concatMap (m:
          761|           map (value: { inherit (m) file; inherit value; }) (builtins.addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))
             |                                                                                                                                         ^
          762|         ) defs;

       … while evaluating definitions from `/nix/store/z22a2sgyx63sl1hc485rcvncfch163ja-darwin/darwin/modules/system':

       … while evaluating anonymous lambda

       at /nix/store/jas3z51rakibqdhmihh895gnzndzhd1s-nixpkgs-22.05.4694.380be19fbd2d/nixpkgs/lib/modules.nix:760:28:

          759|         # Process mkMerge and mkIf properties.
          760|         defs' = concatMap (m:
             |                            ^
          761|           map (value: { inherit (m) file; inherit value; }) (builtins.addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))

       … from call site

       at /nix/store/jas3z51rakibqdhmihh895gnzndzhd1s-nixpkgs-22.05.4694.380be19fbd2d/nixpkgs/lib/modules.nix:760:17:

          759|         # Process mkMerge and mkIf properties.
          760|         defs' = concatMap (m:
             |                 ^
          761|           map (value: { inherit (m) file; inherit value; }) (builtins.addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))

       … while evaluating the attribute 'values'

       at /nix/store/jas3z51rakibqdhmihh895gnzndzhd1s-nixpkgs-22.05.4694.380be19fbd2d/nixpkgs/lib/modules.nix:873:7:

          872|     in {
          873|       values = concatMap (def: if getPrio def == highestPrio then [(strip def)] else []) defs;
             |       ^
          874|       inherit highestPrio;

       … while evaluating the attribute 'values'

       at /nix/store/jas3z51rakibqdhmihh895gnzndzhd1s-nixpkgs-22.05.4694.380be19fbd2d/nixpkgs/lib/modules.nix:774:9:

          773|       in {
          774|         values = defs''';
             |         ^
          775|         inherit (defs'') highestPrio;

       … while evaluating the attribute 'optionalValue'

       at /nix/store/jas3z51rakibqdhmihh895gnzndzhd1s-nixpkgs-22.05.4694.380be19fbd2d/nixpkgs/lib/modules.nix:792:5:

          791|
          792|     optionalValue =
             |     ^
          793|       if isDefined then { value = mergedValue; }

       … while evaluating anonymous lambda

       at /nix/store/jas3z51rakibqdhmihh895gnzndzhd1s-nixpkgs-22.05.4694.380be19fbd2d/nixpkgs/lib/types.nix:432:86:

          431|       merge = loc: defs:
          432|         mapAttrs (n: v: v.value) (filterAttrs (n: v: v ? value) (zipAttrsWith (name: defs:
             |                                                                                      ^
          433|             (mergeDefinitions (loc ++ [name]) elemType defs).optionalValue

       … from call site

       … while evaluating anonymous lambda

       at /nix/store/jas3z51rakibqdhmihh895gnzndzhd1s-nixpkgs-22.05.4694.380be19fbd2d/nixpkgs/lib/types.nix:432:51:

          431|       merge = loc: defs:
          432|         mapAttrs (n: v: v.value) (filterAttrs (n: v: v ? value) (zipAttrsWith (name: defs:
             |                                                   ^
          433|             (mergeDefinitions (loc ++ [name]) elemType defs).optionalValue

       … from call site

       at /nix/store/jas3z51rakibqdhmihh895gnzndzhd1s-nixpkgs-22.05.4694.380be19fbd2d/nixpkgs/lib/attrsets.nix:225:62:

          224|   filterAttrs = pred: set:
          225|     listToAttrs (concatMap (name: let v = set.${name}; in if pred name v then [(nameValuePair name v)] else []) (attrNames set));
             |                                                              ^
          226|

       … while evaluating anonymous lambda

       at /nix/store/jas3z51rakibqdhmihh895gnzndzhd1s-nixpkgs-22.05.4694.380be19fbd2d/nixpkgs/lib/attrsets.nix:225:29:

          224|   filterAttrs = pred: set:
          225|     listToAttrs (concatMap (name: let v = set.${name}; in if pred name v then [(nameValuePair name v)] else []) (attrNames set));
             |                             ^
          226|

       … from call site

       at /nix/store/jas3z51rakibqdhmihh895gnzndzhd1s-nixpkgs-22.05.4694.380be19fbd2d/nixpkgs/lib/attrsets.nix:225:18:

          224|   filterAttrs = pred: set:
          225|     listToAttrs (concatMap (name: let v = set.${name}; in if pred name v then [(nameValuePair name v)] else []) (attrNames set));
             |                  ^
          226|

       … while evaluating 'filterAttrs'

       at /nix/store/jas3z51rakibqdhmihh895gnzndzhd1s-nixpkgs-22.05.4694.380be19fbd2d/nixpkgs/lib/attrsets.nix:224:23:

          223|   */
          224|   filterAttrs = pred: set:
             |                       ^
          225|     listToAttrs (concatMap (name: let v = set.${name}; in if pred name v then [(nameValuePair name v)] else []) (attrNames set));

       … from call site

       at /nix/store/jas3z51rakibqdhmihh895gnzndzhd1s-nixpkgs-22.05.4694.380be19fbd2d/nixpkgs/lib/types.nix:432:35:

          431|       merge = loc: defs:
          432|         mapAttrs (n: v: v.value) (filterAttrs (n: v: v ? value) (zipAttrsWith (name: defs:
             |                                   ^
          433|             (mergeDefinitions (loc ++ [name]) elemType defs).optionalValue

       … while evaluating 'merge'

       at /nix/store/jas3z51rakibqdhmihh895gnzndzhd1s-nixpkgs-22.05.4694.380be19fbd2d/nixpkgs/lib/types.nix:431:20:

          430|       check = isAttrs;
          431|       merge = loc: defs:
             |                    ^
          432|         mapAttrs (n: v: v.value) (filterAttrs (n: v: v ? value) (zipAttrsWith (name: defs:

       … from call site

       at /nix/store/jas3z51rakibqdhmihh895gnzndzhd1s-nixpkgs-22.05.4694.380be19fbd2d/nixpkgs/lib/modules.nix:782:59:

          781|       if isDefined then
          782|         if all (def: type.check def.value) defsFinal then type.merge loc defsFinal
             |                                                           ^
          783|         else let allInvalid = filter (def: ! type.check def.value) defsFinal;

       … while evaluating the attribute 'mergedValue'

       at /nix/store/jas3z51rakibqdhmihh895gnzndzhd1s-nixpkgs-22.05.4694.380be19fbd2d/nixpkgs/lib/modules.nix:780:5:

          779|     # Type-check the remaining definitions, and merge them. Or throw if no definitions.
          780|     mergedValue =
             |     ^
          781|       if isDefined then

       … while evaluating the option `system.build':

       … while evaluating the attribute 'value'

       at /nix/store/jas3z51rakibqdhmihh895gnzndzhd1s-nixpkgs-22.05.4694.380be19fbd2d/nixpkgs/lib/modules.nix:746:9:

          745|     in warnDeprecation opt //
          746|       { value = builtins.addErrorContext "while evaluating the option `${showOption loc}':" value;
             |         ^
          747|         inherit (res.defsFinal') highestPrio;

       … while evaluating anonymous lambda

       at /nix/store/jas3z51rakibqdhmihh895gnzndzhd1s-nixpkgs-22.05.4694.380be19fbd2d/nixpkgs/lib/modules.nix:296:72:

          295|           # For definitions that have an associated option
          296|           declaredConfig = mapAttrsRecursiveCond (v: ! isOption v) (_: v: v.value) options;
             |                                                                        ^
          297|

       … from call site

       at /nix/store/jas3z51rakibqdhmihh895gnzndzhd1s-nixpkgs-22.05.4694.380be19fbd2d/nixpkgs/lib/attrsets.nix:401:20:

          400|               then recurse (path ++ [name]) value
          401|               else f (path ++ [name]) value;
             |                    ^
          402|         in mapAttrs g;

       … while evaluating 'g'

       at /nix/store/jas3z51rakibqdhmihh895gnzndzhd1s-nixpkgs-22.05.4694.380be19fbd2d/nixpkgs/lib/attrsets.nix:398:19:

          397|           g =
          398|             name: value:
             |                   ^
          399|             if isAttrs value && cond value

       … from call site

@awseward
Copy link
Contributor

awseward commented Jun 5, 2024

I was able to finally get past this issue by making the following change in ~/.nix-channels

  https://github.com/LnL7/nix-darwin/archive/master.tar.gz darwin
- https://nixos.org/channels/nixos-22.05 nixpkgs
+ https://nixos.org/channels/nixos-24.05 nixpkgs

@pasviegas, @timsears Wanted to share just in case either of you still hadn't gotten a resolution to this and hadn't tried something similar already.

@pasviegas
Copy link
Author

this worked for me! thank you @awseward

@emilazy
Copy link
Collaborator

emilazy commented Jun 13, 2024

Yeah, 22.05 is too old for us to support; we currently try to support one or two Nixpkgs releases back. #727 might have helped here. In general I would strongly recommend keeping your Nixpkgs channel up to date, as older releases are only supported upstream for a short period of time after a new version.

@emilazy emilazy closed this as completed Jun 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants