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

devShell to eagerly evaluated? #270

Closed
MangoIV opened this issue Mar 12, 2024 · 5 comments · Fixed by #271
Closed

devShell to eagerly evaluated? #270

MangoIV opened this issue Mar 12, 2024 · 5 comments · Fixed by #271

Comments

@MangoIV
Copy link

MangoIV commented Mar 12, 2024

to reproduce

  • set basePackages = pkgs.haskell.packages.ghc90
  • set devShell.enable = false

this should eval error:

error: haskell-language-server has dropped support for ghc 9.0 in version 2.4.0.0, please use a newer ghc version or an older nixpkgs version

I'm suspecting that there is some issue with the devShell being evaluated to eagerly; the package shouldn't depend on haskell-language-server and doesn't try to evaluate/ build it in all other projects

@roberth
Copy link
Collaborator

roberth commented Mar 12, 2024

Can confirm. Here's a trace with hercules-ci-agent.

Trace
$ nix run nix/2.21-maintenance -- eval .#hercules-ci-agent.drvPath --show-trace --no-eval-cache
warning: Git tree '/home/user/h/hercules-ci-agent' is dirty
error:
       … while calling anonymous lambda
         at /nix/store/2p9qcybzmx1rfayjw866rz8xljbw45g9-source/lib/types.nix:593:29:
          592|       merge = loc: defs:
          593|         zipAttrsWith (name: defs:
             |                             ^
          594|           let merged = mergeDefinitions (loc ++ [name]) elemType defs;

       … while evaluating the attribute 'optionalValue.value'
         at /nix/store/2p9qcybzmx1rfayjw866rz8xljbw45g9-source/lib/modules.nix:856:5:
          855|
          856|     optionalValue =
             |     ^
          857|       if isDefined then { value = mergedValue; }

       … while evaluating a branch condition
         at /nix/store/2p9qcybzmx1rfayjw866rz8xljbw45g9-source/lib/modules.nix:857:7:
          856|     optionalValue =
          857|       if isDefined then { value = mergedValue; }
             |       ^
          858|       else {};

       … while evaluating the attribute 'values'
         at /nix/store/2p9qcybzmx1rfayjw866rz8xljbw45g9-source/lib/modules.nix:838:9:
          837|       in {
          838|         values = defs''';
             |         ^
          839|         inherit (defs'') highestPrio;

       … while evaluating a branch condition
         at /nix/store/2p9qcybzmx1rfayjw866rz8xljbw45g9-source/lib/modules.nix:834:11:
          833|           # Avoid sorting if we don't have to.
          834|           if any (def: def.value._type or "" == "order") defs''.values
             |           ^
          835|           then sortProperties defs''.values

       … while calling the 'any' builtin
         at /nix/store/2p9qcybzmx1rfayjw866rz8xljbw45g9-source/lib/modules.nix:834:14:
          833|           # Avoid sorting if we don't have to.
          834|           if any (def: def.value._type or "" == "order") defs''.values
             |              ^
          835|           then sortProperties defs''.values

       … while evaluating the attribute 'values'
         at /nix/store/2p9qcybzmx1rfayjw866rz8xljbw45g9-source/lib/modules.nix:937:7:
          936|     in {
          937|       values = concatMap (def: if getPrio def == highestPrio then [(strip def)] else []) defs;
             |       ^
          938|       inherit highestPrio;

       … while calling the 'concatMap' builtin
         at /nix/store/2p9qcybzmx1rfayjw866rz8xljbw45g9-source/lib/modules.nix:937:16:
          936|     in {
          937|       values = concatMap (def: if getPrio def == highestPrio then [(strip def)] else []) defs;
             |                ^
          938|       inherit highestPrio;

       … while calling the 'concatMap' builtin
         at /nix/store/2p9qcybzmx1rfayjw866rz8xljbw45g9-source/lib/modules.nix:824:17:
          823|         # Process mkMerge and mkIf properties.
          824|         defs' = concatMap (m:
             |                 ^
          825|           map (value: { inherit (m) file; inherit value; }) (builtins.addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))

       … while calling anonymous lambda
         at /nix/store/2p9qcybzmx1rfayjw866rz8xljbw45g9-source/lib/modules.nix:824:28:
          823|         # Process mkMerge and mkIf properties.
          824|         defs' = concatMap (m:
             |                            ^
          825|           map (value: { inherit (m) file; inherit value; }) (builtins.addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))

       … while calling the 'map' builtin
         at /nix/store/2p9qcybzmx1rfayjw866rz8xljbw45g9-source/lib/modules.nix:825:11:
          824|         defs' = concatMap (m:
          825|           map (value: { inherit (m) file; inherit value; }) (builtins.addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))
             |           ^
          826|         ) defs;

       … while calling the 'addErrorContext' builtin
         at /nix/store/2p9qcybzmx1rfayjw866rz8xljbw45g9-source/lib/modules.nix:825:62:
          824|         defs' = concatMap (m:
          825|           map (value: { inherit (m) file; inherit value; }) (builtins.addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))
             |                                                              ^
          826|         ) defs;

       … while evaluating definitions from `/nix/store/5yhqhsl8x9xmhsy3ql8hi05c3zbnxx2x-source/modules/transposition.nix':

       … from call site
         at /nix/store/2p9qcybzmx1rfayjw866rz8xljbw45g9-source/lib/modules.nix:825:137:
          824|         defs' = concatMap (m:
          825|           map (value: { inherit (m) file; inherit value; }) (builtins.addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))
             |                                                                                                                                         ^
          826|         ) defs;

       … while calling 'dischargeProperties'
         at /nix/store/2p9qcybzmx1rfayjw866rz8xljbw45g9-source/lib/modules.nix:896:25:
          895|   */
          896|   dischargeProperties = def:
             |                         ^
          897|     if def._type or "" == "merge" then

       … while evaluating a branch condition
         at /nix/store/2p9qcybzmx1rfayjw866rz8xljbw45g9-source/lib/modules.nix:897:5:
          896|   dischargeProperties = def:
          897|     if def._type or "" == "merge" then
             |     ^
          898|       concatMap dischargeProperties def.contents

       … while evaluating the attribute 'value'
         at /nix/store/2p9qcybzmx1rfayjw866rz8xljbw45g9-source/lib/types.nix:599:58:
          598|         # Push down position info.
          599|         (map (def: mapAttrs (n: v: { inherit (def) file; value = v; }) def.value) defs);
             |                                                          ^
          600|       emptyValue = { value = {}; };

       … from call site
         at /nix/store/2p9qcybzmx1rfayjw866rz8xljbw45g9-source/lib/types.nix:599:58:
          598|         # Push down position info.
          599|         (map (def: mapAttrs (n: v: { inherit (def) file; value = v; }) def.value) defs);
             |                                                          ^
          600|       emptyValue = { value = {}; };

       (12 duplicate frames omitted)

       … while evaluating definitions from `/nix/store/g9np4n11jbvyqi2lqfy8ag4ffqayg293-source/flake.nix, via option perSystem':

       … from call site
         at /nix/store/2p9qcybzmx1rfayjw866rz8xljbw45g9-source/lib/modules.nix:825:137:
          824|         defs' = concatMap (m:
          825|           map (value: { inherit (m) file; inherit value; }) (builtins.addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))
             |                                                                                                                                         ^
          826|         ) defs;

       … while calling 'dischargeProperties'
         at /nix/store/2p9qcybzmx1rfayjw866rz8xljbw45g9-source/lib/modules.nix:896:25:
          895|   */
          896|   dischargeProperties = def:
             |                         ^
          897|     if def._type or "" == "merge" then

       … while evaluating a branch condition
         at /nix/store/2p9qcybzmx1rfayjw866rz8xljbw45g9-source/lib/modules.nix:897:5:
          896|   dischargeProperties = def:
          897|     if def._type or "" == "merge" then
             |     ^
          898|       concatMap dischargeProperties def.contents

       … while evaluating the attribute 'value'
         at /nix/store/2p9qcybzmx1rfayjw866rz8xljbw45g9-source/lib/types.nix:599:58:
          598|         # Push down position info.
          599|         (map (def: mapAttrs (n: v: { inherit (def) file; value = v; }) def.value) defs);
             |                                                          ^
          600|       emptyValue = { value = {}; };

       … from call site
         at /nix/store/g9np4n11jbvyqi2lqfy8ag4ffqayg293-source/flake.nix:465:44:
          464|               packages.hci = config.packages.hercules-ci-cli;
          465|               packages.hercules-ci-agent = config.packages.internal-hercules-ci-agent;
             |                                            ^
          466|

       (12 duplicate frames omitted)

       … while evaluating definitions from `/nix/store/dh7ji7jfgfys3j90cb2sihnyrv9ran0y-source/nix/modules/projects.nix':

       … from call site
         at /nix/store/2p9qcybzmx1rfayjw866rz8xljbw45g9-source/lib/modules.nix:825:137:
          824|         defs' = concatMap (m:
          825|           map (value: { inherit (m) file; inherit value; }) (builtins.addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))
             |                                                                                                                                         ^
          826|         ) defs;

       … while calling 'dischargeProperties'
         at /nix/store/2p9qcybzmx1rfayjw866rz8xljbw45g9-source/lib/modules.nix:896:25:
          895|   */
          896|   dischargeProperties = def:
             |                         ^
          897|     if def._type or "" == "merge" then

       … while evaluating a branch condition
         at /nix/store/2p9qcybzmx1rfayjw866rz8xljbw45g9-source/lib/modules.nix:897:5:
          896|   dischargeProperties = def:
          897|     if def._type or "" == "merge" then
             |     ^
          898|       concatMap dischargeProperties def.contents

       … while evaluating the attribute 'value'
         at /nix/store/2p9qcybzmx1rfayjw866rz8xljbw45g9-source/lib/types.nix:599:58:
          598|         # Push down position info.
          599|         (map (def: mapAttrs (n: v: { inherit (def) file; value = v; }) def.value) defs);
             |                                                          ^
          600|       emptyValue = { value = {}; };

       … from call site
         at /nix/store/2p9qcybzmx1rfayjw866rz8xljbw45g9-source/lib/attrsets.nix:633:36:
          632|     set:
          633|     listToAttrs (map (attr: f attr set.${attr}) (attrNames set));
             |                                    ^
          634|

       … while calling anonymous lambda
         at /nix/store/dh7ji7jfgfys3j90cb2sihnyrv9ran0y-source/nix/modules/projects.nix:44:45:
           43|               let
           44|                 packages = lib.mapAttrs (_: info: info.package) project.outputs.packages;
             |                                             ^
           45|               in

       … from call site
         at /nix/store/dh7ji7jfgfys3j90cb2sihnyrv9ran0y-source/nix/modules/projects.nix:44:51:
           43|               let
           44|                 packages = lib.mapAttrs (_: info: info.package) project.outputs.packages;
             |                                                   ^
           45|               in

       … while calling 'g'
         at /nix/store/2p9qcybzmx1rfayjw866rz8xljbw45g9-source/lib/attrsets.nix:739:19:
          738|           g =
          739|             name: value:
             |                   ^
          740|             if isAttrs value && cond value

       … from call site
         at /nix/store/2p9qcybzmx1rfayjw866rz8xljbw45g9-source/lib/attrsets.nix:742:20:
          741|               then recurse (path ++ [name]) value
          742|               else f (path ++ [name]) value;
             |                    ^
          743|         in mapAttrs g;

       … while calling anonymous lambda
         at /nix/store/2p9qcybzmx1rfayjw866rz8xljbw45g9-source/lib/modules.nix:242:72:
          241|           # For definitions that have an associated option
          242|           declaredConfig = mapAttrsRecursiveCond (v: ! isOption v) (_: v: v.value) options;
             |                                                                        ^
          243|

       … while evaluating the attribute 'value'
         at /nix/store/2p9qcybzmx1rfayjw866rz8xljbw45g9-source/lib/modules.nix:809:9:
          808|     in warnDeprecation opt //
          809|       { value = builtins.addErrorContext "while evaluating the option `${showOption loc}':" value;
             |         ^
          810|         inherit (res.defsFinal') highestPrio;

       … while calling the 'addErrorContext' builtin
         at /nix/store/2p9qcybzmx1rfayjw866rz8xljbw45g9-source/lib/modules.nix:809:17:
          808|     in warnDeprecation opt //
          809|       { value = builtins.addErrorContext "while evaluating the option `${showOption loc}':" value;
             |                 ^
          810|         inherit (res.defsFinal') highestPrio;

       … while evaluating the option `perSystem.x86_64-linux.haskellProjects.internal.outputs.packages.hercules-ci-agent.package':

       … while evaluating the attribute 'mergedValue'
         at /nix/store/2p9qcybzmx1rfayjw866rz8xljbw45g9-source/lib/modules.nix:844:5:
          843|     # Type-check the remaining definitions, and merge them. Or throw if no definitions.
          844|     mergedValue =
             |     ^
          845|       if isDefined then

       … while evaluating a branch condition
         at /nix/store/2p9qcybzmx1rfayjw866rz8xljbw45g9-source/lib/modules.nix:845:7:
          844|     mergedValue =
          845|       if isDefined then
             |       ^
          846|         if all (def: type.check def.value) defsFinal then type.merge loc defsFinal

       (9 duplicate frames omitted)

       … while evaluating definitions from `/nix/store/dh7ji7jfgfys3j90cb2sihnyrv9ran0y-source/nix/modules/project.nix':

       … from call site
         at /nix/store/2p9qcybzmx1rfayjw866rz8xljbw45g9-source/lib/modules.nix:825:137:
          824|         defs' = concatMap (m:
          825|           map (value: { inherit (m) file; inherit value; }) (builtins.addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))
             |                                                                                                                                         ^
          826|         ) defs;

       … while calling 'dischargeProperties'
         at /nix/store/2p9qcybzmx1rfayjw866rz8xljbw45g9-source/lib/modules.nix:896:25:
          895|   */
          896|   dischargeProperties = def:
             |                         ^
          897|     if def._type or "" == "merge" then

       … while evaluating a branch condition
         at /nix/store/2p9qcybzmx1rfayjw866rz8xljbw45g9-source/lib/modules.nix:897:5:
          896|   dischargeProperties = def:
          897|     if def._type or "" == "merge" then
             |     ^
          898|       concatMap dischargeProperties def.contents

       … while evaluating the attribute 'value'
         at /nix/store/2p9qcybzmx1rfayjw866rz8xljbw45g9-source/lib/modules.nix:607:53:
          606|                 (n: value:
          607|                   [{ inherit (module) file; inherit value; }]
             |                                                     ^
          608|                 )

       … from call site
         at /nix/store/dh7ji7jfgfys3j90cb2sihnyrv9ran0y-source/nix/modules/project.nix:182:32:
          181|     let
          182|       inherit (config.outputs) finalPackages packages;
             |                                ^
          183|

       … while calling 'g'
         at /nix/store/2p9qcybzmx1rfayjw866rz8xljbw45g9-source/lib/attrsets.nix:739:19:
          738|           g =
          739|             name: value:
             |                   ^
          740|             if isAttrs value && cond value

       … from call site
         at /nix/store/2p9qcybzmx1rfayjw866rz8xljbw45g9-source/lib/attrsets.nix:742:20:
          741|               then recurse (path ++ [name]) value
          742|               else f (path ++ [name]) value;
             |                    ^
          743|         in mapAttrs g;

       … while calling anonymous lambda
         at /nix/store/2p9qcybzmx1rfayjw866rz8xljbw45g9-source/lib/modules.nix:242:72:
          241|           # For definitions that have an associated option
          242|           declaredConfig = mapAttrsRecursiveCond (v: ! isOption v) (_: v: v.value) options;
             |                                                                        ^
          243|

       … while evaluating the attribute 'value'
         at /nix/store/2p9qcybzmx1rfayjw866rz8xljbw45g9-source/lib/modules.nix:809:9:
          808|     in warnDeprecation opt //
          809|       { value = builtins.addErrorContext "while evaluating the option `${showOption loc}':" value;
             |         ^
          810|         inherit (res.defsFinal') highestPrio;

       … while calling the 'addErrorContext' builtin
         at /nix/store/2p9qcybzmx1rfayjw866rz8xljbw45g9-source/lib/modules.nix:809:17:
          808|     in warnDeprecation opt //
          809|       { value = builtins.addErrorContext "while evaluating the option `${showOption loc}':" value;
             |                 ^
          810|         inherit (res.defsFinal') highestPrio;

       … while evaluating the option `perSystem.x86_64-linux.haskellProjects.internal.outputs.finalPackages':

       (16 duplicate frames omitted)

       … from call site
         at /nix/store/dh7ji7jfgfys3j90cb2sihnyrv9ran0y-source/nix/modules/project.nix:234:25:
          233|
          234|         finalPackages = config.basePackages.extend finalOverlay;
             |                         ^
          235|

       … while calling 'g'
         at /nix/store/2p9qcybzmx1rfayjw866rz8xljbw45g9-source/lib/attrsets.nix:739:19:
          738|           g =
          739|             name: value:
             |                   ^
          740|             if isAttrs value && cond value

       … from call site
         at /nix/store/2p9qcybzmx1rfayjw866rz8xljbw45g9-source/lib/attrsets.nix:742:20:
          741|               then recurse (path ++ [name]) value
          742|               else f (path ++ [name]) value;
             |                    ^
          743|         in mapAttrs g;

       … while calling anonymous lambda
         at /nix/store/2p9qcybzmx1rfayjw866rz8xljbw45g9-source/lib/modules.nix:242:72:
          241|           # For definitions that have an associated option
          242|           declaredConfig = mapAttrsRecursiveCond (v: ! isOption v) (_: v: v.value) options;
             |                                                                        ^
          243|

       … while evaluating the attribute 'value'
         at /nix/store/2p9qcybzmx1rfayjw866rz8xljbw45g9-source/lib/modules.nix:809:9:
          808|     in warnDeprecation opt //
          809|       { value = builtins.addErrorContext "while evaluating the option `${showOption loc}':" value;
             |         ^
          810|         inherit (res.defsFinal') highestPrio;

       … while calling the 'addErrorContext' builtin
         at /nix/store/2p9qcybzmx1rfayjw866rz8xljbw45g9-source/lib/modules.nix:809:17:
          808|     in warnDeprecation opt //
          809|       { value = builtins.addErrorContext "while evaluating the option `${showOption loc}':" value;
             |                 ^
          810|         inherit (res.defsFinal') highestPrio;

       … while evaluating the option `perSystem.x86_64-linux.haskellProjects.internal.basePackages':

       … while evaluating the attribute 'mergedValue'
         at /nix/store/2p9qcybzmx1rfayjw866rz8xljbw45g9-source/lib/modules.nix:844:5:
          843|     # Type-check the remaining definitions, and merge them. Or throw if no definitions.
          844|     mergedValue =
             |     ^
          845|       if isDefined then

       … from call site
         at /nix/store/2p9qcybzmx1rfayjw866rz8xljbw45g9-source/lib/modules.nix:846:59:
          845|       if isDefined then
          846|         if all (def: type.check def.value) defsFinal then type.merge loc defsFinal
             |                                                           ^
          847|         else let allInvalid = filter (def: ! type.check def.value) defsFinal;

       … while calling 'merge'
         at /nix/store/2p9qcybzmx1rfayjw866rz8xljbw45g9-source/lib/types.nix:568:20:
          567|       check = isAttrs;
          568|       merge = loc: defs:
             |                    ^
          569|         mapAttrs (n: v: v.value) (filterAttrs (n: v: v ? value) (zipAttrsWith (name: defs:

       … while calling the 'mapAttrs' builtin
         at /nix/store/2p9qcybzmx1rfayjw866rz8xljbw45g9-source/lib/types.nix:569:9:
          568|       merge = loc: defs:
          569|         mapAttrs (n: v: v.value) (filterAttrs (n: v: v ? value) (zipAttrsWith (name: defs:
             |         ^
          570|             (mergeDefinitions (loc ++ [name]) elemType defs).optionalValue

       … from call site
         at /nix/store/2p9qcybzmx1rfayjw866rz8xljbw45g9-source/lib/types.nix:569:35:
          568|       merge = loc: defs:
          569|         mapAttrs (n: v: v.value) (filterAttrs (n: v: v ? value) (zipAttrsWith (name: defs:
             |                                   ^
          570|             (mergeDefinitions (loc ++ [name]) elemType defs).optionalValue

       … while calling 'filterAttrs'
         at /nix/store/2p9qcybzmx1rfayjw866rz8xljbw45g9-source/lib/attrsets.nix:419:5:
          418|     # The attribute set to filter
          419|     set:
             |     ^
          420|     listToAttrs (concatMap (name: let v = set.${name}; in if pred name v then [(nameValuePair name v)] else []) (attrNames set));

       … while calling the 'listToAttrs' builtin
         at /nix/store/2p9qcybzmx1rfayjw866rz8xljbw45g9-source/lib/attrsets.nix:420:5:
          419|     set:
          420|     listToAttrs (concatMap (name: let v = set.${name}; in if pred name v then [(nameValuePair name v)] else []) (attrNames set));
             |     ^
          421|

       … while calling the 'concatMap' builtin
         at /nix/store/2p9qcybzmx1rfayjw866rz8xljbw45g9-source/lib/attrsets.nix:420:18:
          419|     set:
          420|     listToAttrs (concatMap (name: let v = set.${name}; in if pred name v then [(nameValuePair name v)] else []) (attrNames set));
             |                  ^
          421|

       … while calling anonymous lambda
         at /nix/store/2p9qcybzmx1rfayjw866rz8xljbw45g9-source/lib/attrsets.nix:420:29:
          419|     set:
          420|     listToAttrs (concatMap (name: let v = set.${name}; in if pred name v then [(nameValuePair name v)] else []) (attrNames set));
             |                             ^
          421|

       … while evaluating a branch condition
         at /nix/store/2p9qcybzmx1rfayjw866rz8xljbw45g9-source/lib/attrsets.nix:420:59:
          419|     set:
          420|     listToAttrs (concatMap (name: let v = set.${name}; in if pred name v then [(nameValuePair name v)] else []) (attrNames set));
             |                                                           ^
          421|

       … from call site
         at /nix/store/2p9qcybzmx1rfayjw866rz8xljbw45g9-source/lib/attrsets.nix:420:62:
          419|     set:
          420|     listToAttrs (concatMap (name: let v = set.${name}; in if pred name v then [(nameValuePair name v)] else []) (attrNames set));
             |                                                              ^
          421|

       … while calling anonymous lambda
         at /nix/store/2p9qcybzmx1rfayjw866rz8xljbw45g9-source/lib/types.nix:569:51:
          568|       merge = loc: defs:
          569|         mapAttrs (n: v: v.value) (filterAttrs (n: v: v ? value) (zipAttrsWith (name: defs:
             |                                                   ^
          570|             (mergeDefinitions (loc ++ [name]) elemType defs).optionalValue

       … from call site
         at /nix/store/2p9qcybzmx1rfayjw866rz8xljbw45g9-source/lib/attrsets.nix:420:43:
          419|     set:
          420|     listToAttrs (concatMap (name: let v = set.${name}; in if pred name v then [(nameValuePair name v)] else []) (attrNames set));
             |                                           ^
          421|

       … while calling anonymous lambda
         at /nix/store/2p9qcybzmx1rfayjw866rz8xljbw45g9-source/lib/types.nix:569:86:
          568|       merge = loc: defs:
          569|         mapAttrs (n: v: v.value) (filterAttrs (n: v: v ? value) (zipAttrsWith (name: defs:
             |                                                                                      ^
          570|             (mergeDefinitions (loc ++ [name]) elemType defs).optionalValue

       … while evaluating the attribute 'optionalValue'
         at /nix/store/2p9qcybzmx1rfayjw866rz8xljbw45g9-source/lib/modules.nix:856:5:
          855|
          856|     optionalValue =
             |     ^
          857|       if isDefined then { value = mergedValue; }

       (14 duplicate frames omitted)

       … while evaluating the attribute 'value'
         at /nix/store/2p9qcybzmx1rfayjw866rz8xljbw45g9-source/lib/types.nix:573:60:
          572|           # Push down position info.
          573|           (map (def: mapAttrs (n: v: { inherit (def) file; value = v; }) def.value) defs)));
             |                                                            ^
          574|       emptyValue = { value = {}; };

       … while calling the 'throw' builtin
         at /nix/store/2p9qcybzmx1rfayjw866rz8xljbw45g9-source/pkgs/development/haskell-modules/configuration-ghc-9.0.x.nix:79:30:
           78|
           79|   haskell-language-server =  throw "haskell-language-server has dropped support for ghc 9.0 in version 2.4.0.0, please use a newer ghc version or an older nixpkgs version";
             |                              ^
           80|

       error: haskell-language-server has dropped support for ghc 9.0 in version 2.4.0.0, please use a newer ghc version or an older nixpkgs version

The culprit is types.attrsOf, which supports mkIf and therefore has to perform a filterAttrs based on the attribute values, making it too strict.

Expect an eval performance boost when this is fixed.

roberth added a commit to hercules-ci/haskell-flake that referenced this issue Mar 12, 2024
This means we don't support `mkIf` in the exact places where the
type was `attrsOf`. Almost always, `mkIf` can be replaced by
`optionalAttrs`.

The benefit is that the code becomes much lazier, improving performance
and
- Fixes srid#270
@srid
Copy link
Owner

srid commented Mar 12, 2024

Does that PR fix it? Because devShell.tools already uses typs.lazyAttrsOf.

tools = mkOption {
type = functionTo (types.lazyAttrsOf (types.nullOr types.package));

@roberth
Copy link
Collaborator

roberth commented Mar 12, 2024

I've tried hercules-ci-agent, but got stuck migrating away from its haskell overlay

@srid srid closed this as completed in #271 Mar 12, 2024
srid pushed a commit that referenced this issue Mar 12, 2024
This means we don't support `mkIf` in the exact places where the
type was `attrsOf`. Almost always, `mkIf` can be replaced by
`optionalAttrs`.

The benefit is that the code becomes much lazier, improving performance
and
- Fixes #270
@roberth
Copy link
Collaborator

roberth commented Mar 12, 2024

devShell.tools already uses typs.lazyAttrsOf.

According to the trace I got from the haskell-flake example/, the culprit was basePackages, which was fixed by the PR.
I don't know @MangoIV's project though.

@MangoIV
Copy link
Author

MangoIV commented Mar 12, 2024

jup, worked for me, thank you @roberth <3

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

Successfully merging a pull request may close this issue.

3 participants