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

inputs.std.lib.cfg.editorconfig: attempt to call something which is not a function but a set #328

Closed
montchr opened this issue Jul 1, 2023 · 5 comments

Comments

@montchr
Copy link
Contributor

montchr commented Jul 1, 2023

After nix flake update:

nix flake check --show-trace
warning: Using saved setting for 'extra-experimental-features = nix-command flakes' from ~/.local/share/nix/trusted-settings.json.
warning: Using saved setting for 'extra-substituters = https://dotfield.cachix.org https://nix-community.cachix.org' from ~/.local/share/nix/trusted-settings.json.
warning: Using saved setting for 'extra-trusted-public-keys = dotfield.cachix.org-1:b5H/ucY/9PDARWG9uWA87ZKWUBU+hnfF30amwiXiaNk= nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=' from ~/.local/share/nix/trusted-settings.json.
warning: unknown flake output '__functor'
error: attempt to call something which is not a function but a set

       at /nix/store/bh122g4lgwwsw7qjc1h3vcz9p84zxfry-cells/presets/cfg.nix:14:18:

           13|   };
           14|   editorconfig = std.lib.cfg.editorconfig {
             |                  ^
           15|     data = import ./cfg/editorconfig.nix;

       … while evaluating the attribute 'editorconfig'

       at /nix/store/bh122g4lgwwsw7qjc1h3vcz9p84zxfry-cells/presets/cfg.nix:14:3:

           13|   };
           14|   editorconfig = std.lib.cfg.editorconfig {
             |   ^
           15|     data = import ./cfg/editorconfig.nix;

       … while evaluating the attribute 'value'

       at /nix/store/wsjmyzdq7s99pmagi1kl4xlpaxwjm4vi-source/lib/types.nix:497:38:

          496|               elemType
          497|               [{ inherit (def) file; value = def'; }]
             |                                      ^
          498|             ).optionalValue

       … while evaluating 'dischargeProperties'

       at /nix/store/wsjmyzdq7s99pmagi1kl4xlpaxwjm4vi-source/lib/modules.nix:815:25:

          814|   */
          815|   dischargeProperties = def:
             |                         ^
          816|     if def._type or "" == "merge" then

       … from call site

       at /nix/store/wsjmyzdq7s99pmagi1kl4xlpaxwjm4vi-source/lib/modules.nix:744:137:

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

       … while evaluating definitions from `<unknown-file>':

       … while evaluating anonymous lambda

       at /nix/store/wsjmyzdq7s99pmagi1kl4xlpaxwjm4vi-source/lib/modules.nix:743:28:

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

       … from call site

       at /nix/store/wsjmyzdq7s99pmagi1kl4xlpaxwjm4vi-source/lib/modules.nix:743:17:

          742|         # Process mkMerge and mkIf properties.
          743|         defs' = concatMap (m:
             |                 ^
          744|           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/wsjmyzdq7s99pmagi1kl4xlpaxwjm4vi-source/lib/modules.nix:856:7:

          855|     in {
          856|       values = concatMap (def: if getPrio def == highestPrio then [(strip def)] else []) defs;
             |       ^
          857|       inherit highestPrio;

       … while evaluating the attribute 'values'

       at /nix/store/wsjmyzdq7s99pmagi1kl4xlpaxwjm4vi-source/lib/modules.nix:757:9:

          756|       in {
          757|         values = defs''';
             |         ^
          758|         inherit (defs'') highestPrio;

       … while evaluating the attribute 'optionalValue'

       at /nix/store/wsjmyzdq7s99pmagi1kl4xlpaxwjm4vi-source/lib/modules.nix:775:5:

          774|
          775|     optionalValue =
             |     ^
          776|       if isDefined then { value = mergedValue; }

       … while evaluating anonymous lambda

       at /nix/store/wsjmyzdq7s99pmagi1kl4xlpaxwjm4vi-source/lib/types.nix:493:21:

          492|         map (x: x.value) (filter (x: x ? value) (concatLists (imap1 (n: def:
          493|           imap1 (m: def':
             |                     ^
          494|             (mergeDefinitions

       … from call site

       at /nix/store/wsjmyzdq7s99pmagi1kl4xlpaxwjm4vi-source/lib/lists.nix:117:32:

          116|   */
          117|   imap1 = f: list: genList (n: f (n + 1) (elemAt list n)) (length list);
             |                                ^
          118|

       … while evaluating anonymous lambda

       at /nix/store/wsjmyzdq7s99pmagi1kl4xlpaxwjm4vi-source/lib/lists.nix:117:29:

          116|   */
          117|   imap1 = f: list: genList (n: f (n + 1) (elemAt list n)) (length list);
             |                             ^
          118|

       … from call site

       … while evaluating anonymous lambda

       at /nix/store/wsjmyzdq7s99pmagi1kl4xlpaxwjm4vi-source/lib/types.nix:492:35:

          491|       merge = loc: defs:
          492|         map (x: x.value) (filter (x: x ? value) (concatLists (imap1 (n: def:
             |                                   ^
          493|           imap1 (m: def':

       … from call site

       … while evaluating 'merge'

       at /nix/store/wsjmyzdq7s99pmagi1kl4xlpaxwjm4vi-source/lib/types.nix:491:20:

          490|       check = isList;
          491|       merge = loc: defs:
             |                    ^
          492|         map (x: x.value) (filter (x: x ? value) (concatLists (imap1 (n: def:

       … from call site

       at /nix/store/wsjmyzdq7s99pmagi1kl4xlpaxwjm4vi-source/lib/modules.nix:765:59:

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

       … while evaluating the attribute 'mergedValue'

       at /nix/store/wsjmyzdq7s99pmagi1kl4xlpaxwjm4vi-source/lib/modules.nix:763:5:

          762|     # Type-check the remaining definitions, and merge them. Or throw if no definitions.
          763|     mergedValue =
             |     ^
          764|       if isDefined then

       … while evaluating 'apply'

       at /nix/store/iav28z2bksfafp28qfs1j8f8zij1fjji-incl/lib/dev/mkShell.nix:21:19:

           20|           default = [];
           21|           apply = x: l.catAttrs "__passthru" x;
             |                   ^
           22|           description = "List of `std` Nixago pebbles to load";

       … from call site

       at /nix/store/wsjmyzdq7s99pmagi1kl4xlpaxwjm4vi-source/lib/modules.nix:721:35:

          720|       # yield a value computed from the definitions
          721|       value = if opt ? apply then opt.apply res.mergedValue else res.mergedValue;
             |                                   ^
          722|

       … while evaluating the option `nixago':

       … while evaluating the attribute 'value'

       at /nix/store/wsjmyzdq7s99pmagi1kl4xlpaxwjm4vi-source/lib/modules.nix:728:9:

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

       … while evaluating anonymous lambda

       at /nix/store/wsjmyzdq7s99pmagi1kl4xlpaxwjm4vi-source/lib/modules.nix:270:72:

          269|           # For definitions that have an associated option
          270|           declaredConfig = mapAttrsRecursiveCond (v: ! isOptionv) (_: v: v.value) options;
             |       ^
          271|

       … from call site

       at /nix/store/wsjmyzdq7s99pmagi1kl4xlpaxwjm4vi-source/lib/attrsets.nix:538:20:

          537|               then recurse (path ++ [name]) value
          538|               else f (path ++ [name]) value;
             |                    ^
          539|         in mapAttrs g;

       … while evaluating 'g'

       at /nix/store/wsjmyzdq7s99pmagi1kl4xlpaxwjm4vi-source/lib/attrsets.nix:535:19:

          534|           g =
          535|             name: value:
             |                   ^
          536|             if isAttrs value && cond value

       … from call site

       … while evaluating 'foldl''

       at /nix/store/xpnpp1sq0gmzf72r0iy2ky6r4h4i6vvb-source/lib/lists.nix:83:16:

           82|     let
           83|       foldl' = n:
             |                ^
           84|         if n == -1

       … from call site

       at /nix/store/xpnpp1sq0gmzf72r0iy2ky6r4h4i6vvb-source/lib/lists.nix:87:8:

           86|         else op (foldl' (n - 1)) (elemAt list n);
           87|     in foldl' (length list - 1);
             |        ^
           88|

       … while evaluating 'foldl'

       at /nix/store/xpnpp1sq0gmzf72r0iy2ky6r4h4i6vvb-source/lib/lists.nix:81:20:

           80|   */
           81|   foldl = op: nul: list:
             |                    ^
           82|     let

       … from call site

       at /nix/store/iav28z2bksfafp28qfs1j8f8zij1fjji-incl/lib/dev/mkShell.nix:49:15:

           48|             in
           49|               acc (
             |               ^
           50|                 []

       … while evaluating the attribute 'content'

       at /nix/store/wsjmyzdq7s99pmagi1kl4xlpaxwjm4vi-source/lib/modules.nix:886:14:

          885|     { _type = "if";
          886|       inherit condition content;
             |              ^
          887|     };

       … while evaluating 'pushDownProperties'

       at /nix/store/wsjmyzdq7s99pmagi1kl4xlpaxwjm4vi-source/lib/modules.nix:795:24:

          794|   */
          795|   pushDownProperties = cfg:
             |                        ^
          796|     if cfg._type or "" == "merge" then

       … from call site

       at /nix/store/wsjmyzdq7s99pmagi1kl4xlpaxwjm4vi-source/lib/modules.nix:799:52:

          798|     else if cfg._type or "" == "if" then
          799|       map (mapAttrs (n: v: mkIf cfg.condition v)) (pushDownProperties cfg.content)
             |                                                    ^
          800|     else if cfg._type or "" == "override" then

       … while evaluating 'pushDownProperties'

       at /nix/store/wsjmyzdq7s99pmagi1kl4xlpaxwjm4vi-source/lib/modules.nix:795:24:

          794|   */
          795|   pushDownProperties = cfg:
             |                        ^
          796|     if cfg._type or "" == "merge" then

       … from call site

       at /nix/store/wsjmyzdq7s99pmagi1kl4xlpaxwjm4vi-source/lib/modules.nix:564:69:

          563|       defnsByName = byName "config" (module: value:
          564|           map (config: { inherit (module) file; inherit config;}) (pushDownProperties value)
             |    ^
          565|         ) configs;

       … while evaluating anonymous lambda

       at /nix/store/wsjmyzdq7s99pmagi1kl4xlpaxwjm4vi-source/lib/modules.nix:563:46:

          562|       # an attrset 'name' => list of submodules that define ‘name’.
          563|       defnsByName = byName "config" (module: value:
             |                                              ^
          564|           map (config: { inherit (module) file; inherit config;}) (pushDownProperties value)

       … from call site

       … while evaluating the attribute 'unmatchedDefns'

       at /nix/store/wsjmyzdq7s99pmagi1kl4xlpaxwjm4vi-source/lib/modules.nix:640:7:

          639|       # Transforms unmatchedDefnsByName into a list of definitions
          640|       unmatchedDefns =
             |       ^
          641|         if configs == []

       … while evaluating anonymous lambda

       at /nix/store/wsjmyzdq7s99pmagi1kl4xlpaxwjm4vi-source/lib/modules.nix:633:22:

          632|         # Propagate all unmatched definitions from nested option sets
          633|         mapAttrs (n: v: v.unmatchedDefns) resultsByName
             |                      ^
          634|         # Plus the definitions for the current prefix that don't have a matching option

       … from call site

       … while evaluating anonymous lambda

       at /nix/store/wsjmyzdq7s99pmagi1kl4xlpaxwjm4vi-source/lib/modules.nix:647:46:

          646|         else
          647|           concatLists (mapAttrsToList (name: defs:
             |                                              ^
          648|             map (def: def // {

       … from call site

       at /nix/store/wsjmyzdq7s99pmagi1kl4xlpaxwjm4vi-source/lib/attrsets.nix:479:16:

          478|     attrs:
          479|     map (name: f name attrs.${name}) (attrNames attrs);
             |                ^
          480|

       … while evaluating anonymous lambda

       at /nix/store/wsjmyzdq7s99pmagi1kl4xlpaxwjm4vi-source/lib/attrsets.nix:479:10:

          478|     attrs:
          479|     map (name: f name attrs.${name}) (attrNames attrs);
             |          ^
          480|

       … from call site

       … while evaluating the attribute 'unmatchedDefns'

       at /nix/store/wsjmyzdq7s99pmagi1kl4xlpaxwjm4vi-source/lib/modules.nix:640:7:

          639|       # Transforms unmatchedDefnsByName into a list of definitions
          640|       unmatchedDefns =
             |       ^
          641|         if configs == []

       … while evaluating the attribute 'config.devshell.shell'

       at /nix/store/wsjmyzdq7s99pmagi1kl4xlpaxwjm4vi-source/lib/modules.nix:346:9:

          345|         options = checked options;
          346|         config = checked (removeAttrs config [ "_module" ]);
             |         ^
          347|         _module = checked (config._module);

       … while evaluating the attribute 'shell'

       at /nix/store/pznmrim9hvsmvxagy5accii3rbw686j1-source/modules/default.nix:24:3:

           23|
           24|   shell = module.config.devshell.shell;
             |   ^
           25| }

       … while evaluating 'mkShell'

       at /nix/store/pznmrim9hvsmvxagy5accii3rbw686j1-source/default.nix:68:13:

           67|   # * setup hook for derivation or hercules ci effect
           68|   mkShell = configuration:
             |             ^
           69|     (eval { inherit configuration; }).shell;

       … from call site

       at /nix/store/iav28z2bksfafp28qfs1j8f8zij1fjji-incl/lib/dev/mkShell.nix:59:5:

           58|   in
           59|     devshell.legacyPackages.mkShell {
             |     ^
           60|       imports = [configuration nixagoModule];

       … while evaluating anonymous lambda

       at /nix/store/iav28z2bksfafp28qfs1j8f8zij1fjji-incl/lib/dev/mkShell.nix:9:3:

            8| in
            9|   configuration: let
             |   ^
           10|     nixagoModule = {

       … from call site

       … while checking the derivation 'devShells.x86_64-linux.default'

       … while checking flake output 'devShells'
@montchr
Copy link
Contributor Author

montchr commented Jul 1, 2023

appears to be missing __functor?:

nix-repl> :p inputs.std.aarch64-darwin.lib.cfg.editorconfig
{ data = { }; engine = «lambda @ /nix/store/iav28z2bksfafp28qfs1j8f8zij1fjji-incl/lib/cfg/editorconfig.nix:10:12»; output = ".editorconfig"; packages = [ «derivation /nix/store/zv885src5x3ir8x1q38xipzbhgv0rmxb-editorconfig-checker-2.7.0.drv» ]; }

@blaggacao
Copy link
Collaborator

Hm maybe it's better to avoid main for a while until I can publish a release with some migration guidelines.. 😄 -- I still want to increase test coverage and add some golden templates, though.

In this particular case, you almost certainly need to trace this commit and specifically this change preparing the ground for #294

@henrywong-crypto
Copy link
Contributor

henrywong-crypto commented Jul 3, 2023

Thank you for the hints, I can use it like this

((lib.dev.mkNixago lib.cfg.lefthook) cell.configs.lefthook)

@Pegasust
Copy link
Contributor

With these comments, I think it's sufficient to close this issue. Are there any other unaddressed concerns?

@montchr
Copy link
Contributor Author

montchr commented Jul 23, 2023

No longer an issue.

@montchr montchr closed this as completed Jul 23, 2023
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