NotAShelf / nvf

A highly modular, extensible and distro-agnostic Neovim configuration framework for Nix/NixOS.
https://notashelf.github.io/nvf/
MIT License
158 stars 26 forks source link

Null coercion error when setting mappings to null #281

Closed Nowaaru closed 4 months ago

Nowaaru commented 4 months ago

⚠️ Please verify that this bug has NOT been reported before.

Description

Mappings specified in the documentation error out when setting the options to null. Assuming this occurs for all mkBinding calls.

👟 Reproduction steps

Set a mapping to null.

👀 Expected behavior

The mapping should disable.

😓 Actual Behavior

The mapping errors.

💻 Metadata

📝 Relevant log output

error:
       … while calling the 'derivationStrict' builtin
         at <nix/derivation-internal.nix>:9:12:
            8|
            9|   strict = derivationStrict drvAttrs;
             |            ^
           10|

       … while evaluating derivation 'home-manager-generation'
         whose name attribute is located at /nix/store/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-source/pkgs/stdenv/generic/make-derivation.nix:331:7

       … while evaluating attribute 'buildCommand' of derivation 'home-manager-generation'
         at /nix/store/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-source/pkgs/build-support/trivial-builders/default.nix:68:17:
           67|         enableParallelBuilding = true;
           68|         inherit buildCommand name;
             |                 ^
           69|         passAsFile = [ "buildCommand" ]

       … while calling the 'getAttr' builtin
         at <nix/derivation-internal.nix>:19:19:
           18|       value = commonAttrs // {
           19|         outPath = builtins.getAttr outputName strict;
             |                   ^
           20|         drvPath = strict.drvPath;

       … while calling the 'derivationStrict' builtin
         at <nix/derivation-internal.nix>:9:12:
            8|
            9|   strict = derivationStrict drvAttrs;
             |            ^
           10|

       … while evaluating derivation 'activation-script'
         whose name attribute is located at /nix/store/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-source/pkgs/stdenv/generic/make-derivation.nix:331:7

       … while evaluating attribute 'text' of derivation 'activation-script'
         at /nix/store/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-source/pkgs/build-support/trivial-builders/default.nix:103:17:
          102|       ({
          103|         inherit text executable checkPhase allowSubstitutes preferLocalBuild;
             |                 ^
          104|         passAsFile = [ "text" ]

       … while calling the 'concatStringsSep' builtin
         at /nix/store/nyrfvrd48qz1kch85hkzanddlh800c44-source/modules/home-environment.nix:673:13:
          672|           if sortedCommands ? result then
          673|             concatStringsSep "\n" (map mkCmd sortedCommands.result)
             |             ^
          674|           else

       … while calling 'mkCmd'
         at /nix/store/nyrfvrd48qz1kch85hkzanddlh800c44-source/modules/home-environment.nix:666:17:
          665|       let
          666|         mkCmd = res: ''
             |                 ^
          667|             _iNote "Activating %s" "${res.name}"

       … while evaluating the attribute 'data'
         at /nix/store/nyrfvrd48qz1kch85hkzanddlh800c44-source/modules/lib/dag.nix:89:43:
           88|     in if sorted ? result then {
           89|       result = map (v: { inherit (v) name data; }) sorted.result;
             |                                           ^
           90|     } else

       … while evaluating the attribute 'data'
         at /nix/store/nyrfvrd48qz1kch85hkzanddlh800c44-source/modules/lib/dag.nix:83:9:
           82|         name = n;
           83|         data = v.data;
             |         ^
           84|         after = v.after ++ dagBefore dag n;

       … from call site
         at /nix/store/nyrfvrd48qz1kch85hkzanddlh800c44-source/modules/lib/dag.nix:83:16:
           82|         name = n;
           83|         data = v.data;
             |                ^
           84|         after = v.after ++ dagBefore dag n;

       … while calling anonymous lambda
         at /nix/store/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-source/lib/attrsets.nix:1205:18:
         1204|         mapAttrs
         1205|           (name: value:
             |                  ^
         1206|             if isAttrs value && cond value

       … from call site
         at /nix/store/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-source/lib/attrsets.nix:1208:18:
         1207|             then recurse (path ++ [ name ]) value
         1208|             else f (path ++ [ name ]) value);
             |                  ^
         1209|     in

       … while calling anonymous lambda
         at /nix/store/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-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/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-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/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-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 `home.activation.installPackages.data':

       … while evaluating the attribute 'mergedValue'
         at /nix/store/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-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/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-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

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

       … while evaluating a branch condition
         at /nix/store/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-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/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-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/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-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/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-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/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-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/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-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/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-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/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-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/nyrfvrd48qz1kch85hkzanddlh800c44-source/modules/home-environment.nix':

       … from call site
         at /nix/store/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-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/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-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/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-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/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-source/lib/modules.nix:607:53:
          606|                 (n: value:
          607|                   [{ inherit (module) file; inherit value; }]
             |                                                     ^
          608|                 )

       … while calling the 'getAttr' builtin
         at <nix/derivation-internal.nix>:19:19:
           18|       value = commonAttrs // {
           19|         outPath = builtins.getAttr outputName strict;
             |                   ^
           20|         drvPath = strict.drvPath;

       … while calling the 'derivationStrict' builtin
         at <nix/derivation-internal.nix>:9:12:
            8|
            9|   strict = derivationStrict drvAttrs;
             |            ^
           10|

       … while evaluating derivation 'home-manager-path'
         whose name attribute is located at /nix/store/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-source/pkgs/stdenv/generic/make-derivation.nix:331:7

       … while evaluating attribute 'passAsFile' of derivation 'home-manager-path'
         at /nix/store/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-source/pkgs/build-support/trivial-builders/default.nix:69:9:
           68|         inherit buildCommand name;
           69|         passAsFile = [ "buildCommand" ]
             |         ^
           70|           ++ (derivationArgs.passAsFile or [ ]);

       … while evaluating the attribute 'passAsFile'
         at /nix/store/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-source/pkgs/build-support/buildenv/default.nix:76:5:
           75|     # XXX: The size is somewhat arbitrary
           76|     passAsFile = if builtins.stringLength pkgs >= 128*1024 then [ "pkgs" ] else [ ];
             |     ^
           77|   }

       … while evaluating a branch condition
         at /nix/store/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-source/pkgs/build-support/buildenv/default.nix:76:18:
           75|     # XXX: The size is somewhat arbitrary
           76|     passAsFile = if builtins.stringLength pkgs >= 128*1024 then [ "pkgs" ] else [ ];
             |                  ^
           77|   }

       … in the argument of the not operator
         at /nix/store/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-source/pkgs/build-support/buildenv/default.nix:76:48:
           75|     # XXX: The size is somewhat arbitrary
           76|     passAsFile = if builtins.stringLength pkgs >= 128*1024 then [ "pkgs" ] else [ ];
             |                                                ^
           77|   }

       … while calling the 'lessThan' builtin
         at /nix/store/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-source/pkgs/build-support/buildenv/default.nix:76:48:
           75|     # XXX: The size is somewhat arbitrary
           76|     passAsFile = if builtins.stringLength pkgs >= 128*1024 then [ "pkgs" ] else [ ];
             |                                                ^
           77|   }

       … while calling the 'stringLength' builtin
         at /nix/store/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-source/pkgs/build-support/buildenv/default.nix:76:21:
           75|     # XXX: The size is somewhat arbitrary
           76|     passAsFile = if builtins.stringLength pkgs >= 128*1024 then [ "pkgs" ] else [ ];
             |                     ^
           77|   }

       … while calling the 'toJSON' builtin
         at /nix/store/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-source/pkgs/build-support/buildenv/default.nix:58:12:
           57|             nativeBuildInputs buildInputs;
           58|     pkgs = builtins.toJSON (map (drv: {
             |            ^
           59|       paths =

       … while evaluating list element at index 0

       … while evaluating attribute 'paths'
         at /nix/store/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-source/pkgs/build-support/buildenv/default.nix:59:7:
           58|     pkgs = builtins.toJSON (map (drv: {
           59|       paths =
             |       ^
           60|         # First add the usual output(s): respect if user has chosen explicitly,

       … while evaluating list element at index 0
         at /nix/store/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-source/pkgs/build-support/buildenv/default.nix:59:7:
           58|     pkgs = builtins.toJSON (map (drv: {
           59|       paths =
             |       ^
           60|         # First add the usual output(s): respect if user has chosen explicitly,

       … while calling the 'getAttr' builtin
         at <nix/derivation-internal.nix>:19:19:
           18|       value = commonAttrs // {
           19|         outPath = builtins.getAttr outputName strict;
             |                   ^
           20|         drvPath = strict.drvPath;

       … while calling the 'derivationStrict' builtin
         at <nix/derivation-internal.nix>:9:12:
            8|
            9|   strict = derivationStrict drvAttrs;
             |            ^
           10|

       … while evaluating derivation 'neovim-0.9.5'
         whose name attribute is located at /nix/store/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-source/pkgs/stdenv/generic/make-derivation.nix:331:7

       … while evaluating attribute 'luaRcContent' of derivation 'neovim-0.9.5'
         at /nix/store/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-source/pkgs/applications/editors/neovim/wrapper.nix:100:7:
           99|       inherit wrapperArgs generatedWrapperArgs;
          100|       luaRcContent = rcContent;
             |       ^
          101|       # Remove the symlinks created by symlinkJoin which we need to perform

       … from call site
         at /nix/store/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-source/pkgs/applications/editors/neovim/wrapper.nix:50:10:
           49|       ${luaRcContent}
           50|     '' + lib.optionalString (!isNull neovimRcContent) ''
             |          ^
           51|       vim.cmd.source "${writeText "init.vim" neovimRcContent}"

       … while calling 'optionalString'
         at /nix/store/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-source/lib/strings.nix:268:5:
          267|     # String to return if condition is true
          268|     string: if cond then string else "";
             |     ^
          269|

       … while evaluating a branch condition
         at /nix/store/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-source/lib/strings.nix:268:13:
          267|     # String to return if condition is true
          268|     string: if cond then string else "";
             |             ^
          269|

       … in the argument of the not operator
         at /nix/store/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-source/pkgs/applications/editors/neovim/wrapper.nix:50:31:
           49|       ${luaRcContent}
           50|     '' + lib.optionalString (!isNull neovimRcContent) ''
             |                               ^
           51|       vim.cmd.source "${writeText "init.vim" neovimRcContent}"

       … while calling the 'isNull' builtin
         at /nix/store/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-source/pkgs/applications/editors/neovim/wrapper.nix:50:31:
           49|       ${luaRcContent}
           50|     '' + lib.optionalString (!isNull neovimRcContent) ''
             |                               ^
           51|       vim.cmd.source "${writeText "init.vim" neovimRcContent}"

       … while calling anonymous lambda
         at /nix/store/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-source/lib/attrsets.nix:1571:24:
         1570|     let f = attrPath:
         1571|       zipAttrsWith (n: values:
             |                        ^
         1572|         let here = attrPath ++ [n]; in

       … while calling the 'head' builtin
         at /nix/store/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-source/lib/attrsets.nix:1575:11:
         1574|         || pred here (elemAt values 1) (head values) then
         1575|           head values
             |           ^
         1576|         else

       … from call site
         at /nix/store/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-source/pkgs/applications/editors/neovim/utils.nix:106:25:
          105|       # we call vimrcContent without 'packages' to avoid the init.vim generation
          106|       neovimRcContent = vimUtils.vimrcContent ({
             |                         ^
          107|         beforePlugins = "";

       … while calling 'vimrcContent'
         at /nix/store/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-source/pkgs/applications/editors/vim/plugins/vim-utils.nix:227:18:
          226|    */
          227|   vimrcContent = {
             |                  ^
          228|     packages ? null,

       … while calling the 'concatStringsSep' builtin
         at /nix/store/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-source/pkgs/applications/editors/vim/plugins/vim-utils.nix:277:7:
          276|     in
          277|       lib.concatStringsSep "\n" (lib.filter (x: x != null && x != "") entries);
             |       ^
          278|

       … while calling the 'filter' builtin
         at /nix/store/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-source/pkgs/applications/editors/vim/plugins/vim-utils.nix:277:34:
          276|     in
          277|       lib.concatStringsSep "\n" (lib.filter (x: x != null && x != "") entries);
             |                                  ^
          278|

       … while calling anonymous lambda
         at /nix/store/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-source/pkgs/applications/editors/vim/plugins/vim-utils.nix:277:46:
          276|     in
          277|       lib.concatStringsSep "\n" (lib.filter (x: x != null && x != "") entries);
             |                                              ^
          278|

       … in the left operand of the AND (&&) operator
         at /nix/store/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-source/pkgs/applications/editors/vim/plugins/vim-utils.nix:277:59:
          276|     in
          277|       lib.concatStringsSep "\n" (lib.filter (x: x != null && x != "") entries);
             |                                                           ^
          278|

       … while calling the 'concatStringsSep' builtin
         at /nix/store/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-source/pkgs/applications/editors/neovim/utils.nix:108:20:
          107|         beforePlugins = "";
          108|         customRC = lib.concatStringsSep "\n" (pluginRC ++ [customRC]);
             |                    ^
          109|         packages = null;

       … from call site
         at /nix/store/77nbmwc1lqzc1cp1q8jl6z10z2q9b17p-source/modules/default.nix:112:16:
          111|     inherit plugins extraLuaPackages extraPython3Packages;
          112|     customRC = vimOptions.builtConfigRC;
             |                ^
          113|   };

       … while calling anonymous lambda
         at /nix/store/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-source/lib/attrsets.nix:1205:18:
         1204|         mapAttrs
         1205|           (name: value:
             |                  ^
         1206|             if isAttrs value && cond value

       … from call site
         at /nix/store/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-source/lib/attrsets.nix:1208:18:
         1207|             then recurse (path ++ [ name ]) value
         1208|             else f (path ++ [ name ]) value);
             |                  ^
         1209|     in

       … while calling anonymous lambda
         at /nix/store/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-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/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-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/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-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 `vim.builtConfigRC':

       (11 duplicate frames omitted)

       … while evaluating definitions from `/nix/store/77nbmwc1lqzc1cp1q8jl6z10z2q9b17p-source/modules/wrapper/rc/config.nix':

       … from call site
         at /nix/store/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-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/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-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/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-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/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-source/lib/modules.nix:607:53:
          606|                 (n: value:
          607|                   [{ inherit (module) file; inherit value; }]
             |                                                     ^
          608|                 )

       … from call site
         at /nix/store/77nbmwc1lqzc1cp1q8jl6z10z2q9b17p-source/modules/wrapper/rc/config.nix:210:9:
          209|       in
          210|         baseSystemAssertWarn vimConfig;
             |         ^
          211|     };

       … while calling 'showWarnings'
         at /nix/store/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-source/lib/trivial.nix:867:28:
          866|
          867|   showWarnings = warnings: res: lib.foldr (w: x: warn w x) res warnings;
             |                            ^
          868|

       … from call site
         at /nix/store/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-source/lib/trivial.nix:867:33:
          866|
          867|   showWarnings = warnings: res: lib.foldr (w: x: warn w x) res warnings;
             |                                 ^
          868|

       … while calling 'foldr'
         at /nix/store/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-source/lib/lists.nix:121:20:
          120|   */
          121|   foldr = op: nul: list:
             |                    ^
          122|     let

       … from call site
         at /nix/store/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-source/lib/lists.nix:128:8:
          127|         else op (elemAt list n) (fold' (n + 1));
          128|     in fold' 0;
             |        ^
          129|

       … while calling 'fold''
         at /nix/store/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-source/lib/lists.nix:124:15:
          123|       len = length list;
          124|       fold' = n:
             |               ^
          125|         if n == len

       … from call site
         at /nix/store/77nbmwc1lqzc1cp1q8jl6z10z2q9b17p-source/modules/wrapper/rc/config.nix:204:21:
          203|         mapResult = result: (concatStringsSep "\n" (map mkVimrcSection result));
          204|         vimConfig = resolveDag {
             |                     ^
          205|           name = "vim config script";

       … while calling 'resolveDag'
         at /nix/store/77nbmwc1lqzc1cp1q8jl6z10z2q9b17p-source/modules/wrapper/rc/config.nix:113:18:
          112|
          113|     resolveDag = {
             |                  ^
          114|       name,

       … from call site
         at /nix/store/77nbmwc1lqzc1cp1q8jl6z10z2q9b17p-source/modules/wrapper/rc/config.nix:127:14:
          126|         if sortedDag ? result
          127|         then mapResult sortedDag.result
             |              ^
          128|         else abort ("Dependency cycle in ${name}: " + toJSON sortedDag);

       … while calling 'mapResult'
         at /nix/store/77nbmwc1lqzc1cp1q8jl6z10z2q9b17p-source/modules/wrapper/rc/config.nix:203:21:
          202|
          203|         mapResult = result: (concatStringsSep "\n" (map mkVimrcSection result));
             |                     ^
          204|         vimConfig = resolveDag {

       … while calling the 'concatStringsSep' builtin
         at /nix/store/77nbmwc1lqzc1cp1q8jl6z10z2q9b17p-source/modules/wrapper/rc/config.nix:203:30:
          202|
          203|         mapResult = result: (concatStringsSep "\n" (map mkVimrcSection result));
             |                              ^
          204|         vimConfig = resolveDag {

       … while calling 'mkVimrcSection'
         at /nix/store/77nbmwc1lqzc1cp1q8jl6z10z2q9b17p-source/lib/dag.nix:151:20:
          150|
          151|   mkVimrcSection = section: ''
             |                    ^
          152|     " SECTION: ${section.name}

       … while evaluating the attribute 'data'
         at /nix/store/77nbmwc1lqzc1cp1q8jl6z10z2q9b17p-source/lib/dag.nix:96:42:
           95|     then {
           96|       result = map (v: {inherit (v) name data;}) sorted.result;
             |                                          ^
           97|     }

       … while evaluating the attribute 'data'
         at /nix/store/77nbmwc1lqzc1cp1q8jl6z10z2q9b17p-source/lib/dag.nix:87:9:
           86|         name = n;
           87|         data = v.data;
             |         ^
           88|         after = v.after ++ dagBefore dag n;

       … from call site
         at /nix/store/77nbmwc1lqzc1cp1q8jl6z10z2q9b17p-source/lib/dag.nix:87:16:
           86|         name = n;
           87|         data = v.data;
             |                ^
           88|         after = v.after ++ dagBefore dag n;

       … while calling anonymous lambda
         at /nix/store/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-source/lib/attrsets.nix:1205:18:
         1204|         mapAttrs
         1205|           (name: value:
             |                  ^
         1206|             if isAttrs value && cond value

       … from call site
         at /nix/store/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-source/lib/attrsets.nix:1208:18:
         1207|             then recurse (path ++ [ name ]) value
         1208|             else f (path ++ [ name ]) value);
             |                  ^
         1209|     in

       … while calling anonymous lambda
         at /nix/store/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-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/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-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/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-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 `vim.configRC.luaScript.data':

       (16 duplicate frames omitted)

       … from call site
         at /nix/store/77nbmwc1lqzc1cp1q8jl6z10z2q9b17p-source/modules/wrapper/rc/config.nix:145:23:
          144|
          145|           luaConfig = resolveDag {
             |                       ^
          146|             name = "lua config script";

       … while calling 'resolveDag'
         at /nix/store/77nbmwc1lqzc1cp1q8jl6z10z2q9b17p-source/modules/wrapper/rc/config.nix:113:18:
          112|
          113|     resolveDag = {
             |                  ^
          114|       name,

       … while evaluating a branch condition
         at /nix/store/77nbmwc1lqzc1cp1q8jl6z10z2q9b17p-source/modules/wrapper/rc/config.nix:126:9:
          125|       result =
          126|         if sortedDag ? result
             |         ^
          127|         then mapResult sortedDag.result

       … from call site
         at /nix/store/77nbmwc1lqzc1cp1q8jl6z10z2q9b17p-source/modules/wrapper/rc/config.nix:124:19:
          123|       dag;
          124|       sortedDag = topoSort finalDag;
             |                   ^
          125|       result =

       … while calling 'topoSort'
         at /nix/store/77nbmwc1lqzc1cp1q8jl6z10z2q9b17p-source/lib/dag.nix:80:14:
           79|   */
           80|   topoSort = dag: let
             |              ^
           81|     dagBefore = dag: name:

       … while evaluating a branch condition
         at /nix/store/77nbmwc1lqzc1cp1q8jl6z10z2q9b17p-source/lib/dag.nix:94:5:
           93|   in
           94|     if sorted ? result
             |     ^
           95|     then {

       … from call site
         at /nix/store/77nbmwc1lqzc1cp1q8jl6z10z2q9b17p-source/lib/dag.nix:92:14:
           91|     before = a: b: elem a.name b.after;
           92|     sorted = toposort before (attrValues normalizedDag);
             |              ^
           93|   in

       … while calling 'toposort'
         at /nix/store/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-source/lib/lists.nix:1218:22:
         1217|   */
         1218|   toposort = before: list:
             |                      ^
         1219|     let

       … while evaluating a branch condition
         at /nix/store/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-source/lib/lists.nix:1223:7:
         1222|     in
         1223|       if length list < 2
             |       ^
         1224|       then # finish

       … while calling the 'lessThan' builtin
         at /nix/store/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-source/lib/lists.nix:1223:22:
         1222|     in
         1223|       if length list < 2
             |                      ^
         1224|       then # finish

       … while calling the 'length' builtin
         at /nix/store/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-source/lib/lists.nix:1223:10:
         1222|     in
         1223|       if length list < 2
             |          ^
         1224|       then # finish

       … while calling the 'attrValues' builtin
         at /nix/store/77nbmwc1lqzc1cp1q8jl6z10z2q9b17p-source/lib/dag.nix:92:31:
           91|     before = a: b: elem a.name b.after;
           92|     sorted = toposort before (attrValues normalizedDag);
             |                               ^
           93|   in

       … while calling the 'mapAttrs' builtin
         at /nix/store/77nbmwc1lqzc1cp1q8jl6z10z2q9b17p-source/lib/dag.nix:85:7:
           84|     normalizedDag =
           85|       mapAttrs (n: v: {
             |       ^
           86|         name = n;

       … while calling the 'mapAttrs' builtin
         at /nix/store/77nbmwc1lqzc1cp1q8jl6z10z2q9b17p-source/modules/wrapper/rc/config.nix:119:18:
          118|       # When the value is a string, default it to dag.entryAnywhere
          119|       finalDag = mapAttrs (_: value:
             |                  ^
          120|         if isString value

       … from call site
         at /nix/store/77nbmwc1lqzc1cp1q8jl6z10z2q9b17p-source/modules/wrapper/rc/config.nix:147:19:
          146|             name = "lua config script";
          147|             dag = cfg.luaConfigRC;
             |                   ^
          148|             inherit mapResult;

       … while calling anonymous lambda
         at /nix/store/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-source/lib/attrsets.nix:1205:18:
         1204|         mapAttrs
         1205|           (name: value:
             |                  ^
         1206|             if isAttrs value && cond value

       … from call site
         at /nix/store/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-source/lib/attrsets.nix:1208:18:
         1207|             then recurse (path ++ [ name ]) value
         1208|             else f (path ++ [ name ]) value);
             |                  ^
         1209|     in

       … while calling anonymous lambda
         at /nix/store/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-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/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-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/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-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 `vim.luaConfigRC':

       … while evaluating the attribute 'mergedValue'
         at /nix/store/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-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/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-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/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-source/lib/types.nix:991:20:
          990|       check = x: t1.check x || t2.check x;
          991|       merge = loc: defs:
             |                    ^
          992|         let

       … from call site
         at /nix/store/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-source/lib/types.nix:999:16:
          998|                then t2.merge loc defs
          999|           else mergeOneOption loc defs;
             |                ^
         1000|       typeMerge = f':

       … while calling 'mergeUniqueOption'
         at /nix/store/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-source/lib/options.nix:276:10:
          275|       merge ? loc: defs: (head defs).value }:
          276|     loc: defs:
             |          ^
          277|       if length defs == 1

       … while calling the 'throw' builtin
         at /nix/store/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-source/lib/options.nix:281:9:
          280|         assert length defs > 1;
          281|         throw "The option `${showOption loc}' is defined multiple times while it's expected to be unique.\n${message}\nDefinition values:${showDefs defs}\n${prioritySuggestion}";
             |         ^
          282|

       … from call site
         at /nix/store/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-source/lib/options.nix:281:140:
          280|         assert length defs > 1;
          281|         throw "The option `${showOption loc}' is defined multiple times while it's expected to be unique.\n${message}\nDefinition values:${showDefs defs}\n${prioritySuggestion}";
             |                                                                                                                                            ^
          282|

       … while calling 'showDefs'
         at /nix/store/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-source/lib/options.nix:447:14:
          446|
          447|   showDefs = defs: concatMapStrings (def:
             |              ^
          448|     let

       … from call site
         at /nix/store/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-source/lib/options.nix:447:20:
          446|
          447|   showDefs = defs: concatMapStrings (def:
             |                    ^
          448|     let

       … while calling 'concatMapStrings'
         at /nix/store/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-source/lib/strings.nix:60:25:
           59|   */
           60|   concatMapStrings = f: list: concatStrings (map f list);
             |                         ^
           61|

       … while calling the 'concatStringsSep' builtin
         at /nix/store/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-source/lib/strings.nix:60:31:
           59|   */
           60|   concatMapStrings = f: list: concatStrings (map f list);
             |                               ^
           61|

       … while calling anonymous lambda
         at /nix/store/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-source/lib/options.nix:447:38:
          446|
          447|   showDefs = defs: concatMapStrings (def:
             |                                      ^
          448|     let

       … while evaluating a branch condition
         at /nix/store/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-source/lib/options.nix:459:9:
          458|         # Don't print any value if evaluating the value strictly fails
          459|         if ! prettyEval.success then ""
             |         ^
          460|         # Put it on a new line if it consists of multiple

       … in the argument of the not operator
         at /nix/store/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-source/lib/options.nix:459:14:
          458|         # Don't print any value if evaluating the value strictly fails
          459|         if ! prettyEval.success then ""
             |              ^
          460|         # Put it on a new line if it consists of multiple

       … while calling the 'tryEval' builtin
         at /nix/store/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-source/lib/options.nix:450:20:
          449|       # Pretty print the value for display, if successful
          450|       prettyEval = builtins.tryEval
             |                    ^
          451|         (lib.generators.toPretty { }

       … from call site
         at /nix/store/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-source/lib/options.nix:451:10:
          450|       prettyEval = builtins.tryEval
          451|         (lib.generators.toPretty { }
             |          ^
          452|           (lib.generators.withRecursion { depthLimit = 10; throwOnDepthLimit = false; } def.value));

       … while calling 'go'
         at /nix/store/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-source/lib/generators.nix:343:18:
          342|     let
          343|     go = indent: v:
             |                  ^
          344|     let     introSpace = if multiline then "\n${indent}  " else " ";

       … while calling the 'concatStringsSep' builtin
         at /nix/store/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-source/lib/generators.nix:390:13:
          389|       else "{" + introSpace
          390|           + concatStringsSep introSpace (mapAttrsToList
             |             ^
          391|               (name: value:

       … while calling anonymous lambda
         at /nix/store/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-source/lib/attrsets.nix:1096:10:
         1095|     attrs:
         1096|     map (name: f name attrs.${name}) (attrNames attrs);
             |          ^
         1097|

       … from call site
         at /nix/store/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-source/lib/attrsets.nix:1096:16:
         1095|     attrs:
         1096|     map (name: f name attrs.${name}) (attrNames attrs);
             |                ^
         1097|

       … while calling anonymous lambda
         at /nix/store/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-source/lib/generators.nix:391:22:
          390|           + concatStringsSep introSpace (mapAttrsToList
          391|               (name: value:
             |                      ^
          392|                 "${escapeNixIdentifier name} = ${

       … while calling the 'addErrorContext' builtin
         at /nix/store/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-source/lib/generators.nix:393:19:
          392|                 "${escapeNixIdentifier name} = ${
          393|                   addErrorContext "while evaluating an attribute `${name}`"
             |                   ^
          394|                     (go (indent + "  ") value)

       … while evaluating an attribute `lsp-setup`

       … from call site
         at /nix/store/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-source/lib/generators.nix:394:22:
          393|                   addErrorContext "while evaluating an attribute `${name}`"
          394|                     (go (indent + "  ") value)
             |                      ^
          395|                 };") v)

       … while calling 'go'
         at /nix/store/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-source/lib/generators.nix:343:18:
          342|     let
          343|     go = indent: v:
             |                  ^
          344|     let     introSpace = if multiline then "\n${indent}  " else " ";

       … while evaluating a branch condition
         at /nix/store/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-source/lib/generators.nix:346:8:
          345|             outroSpace = if multiline then "\n${indent}" else " ";
          346|     in if   isInt      v then toString v
             |        ^
          347|     # toString loses precision on floats, so we use toJSON instead. This isn't perfect

       … while calling the 'isInt' builtin
         at /nix/store/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-source/lib/generators.nix:346:13:
          345|             outroSpace = if multiline then "\n${indent}" else " ";
          346|     in if   isInt      v then toString v
             |             ^
          347|     # toString loses precision on floats, so we use toJSON instead. This isn't perfect

       … from call site
         at /nix/store/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-source/lib/attrsets.nix:1096:23:
         1095|     attrs:
         1096|     map (name: f name attrs.${name}) (attrNames attrs);
             |                       ^
         1097|

       … while calling 'evalNext'
         at /nix/store/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-source/lib/generators.nix:318:24:
          317|           let
          318|             evalNext = x: mapAny (depth + 1) (transform (depth + 1) x);
             |                        ^
          319|           in

       … from call site
         at /nix/store/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-source/lib/generators.nix:318:27:
          317|           let
          318|             evalNext = x: mapAny (depth + 1) (transform (depth + 1) x);
             |                           ^
          319|           in

       … while calling 'mapAny'
         at /nix/store/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-source/lib/generators.nix:316:25:
          315|           else id;
          316|         mapAny = depth: v:
             |                         ^
          317|           let

       … while evaluating a branch condition
         at /nix/store/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-source/lib/generators.nix:320:13:
          319|           in
          320|             if isAttrs v then mapAttrs (stepIntoAttr evalNext) v
             |             ^
          321|             else if isList v then map evalNext v

       … while calling the 'isAttrs' builtin
         at /nix/store/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-source/lib/generators.nix:320:16:
          319|           in
          320|             if isAttrs v then mapAttrs (stepIntoAttr evalNext) v
             |                ^
          321|             else if isList v then map evalNext v

       … from call site
         at /nix/store/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-source/lib/generators.nix:318:47:
          317|           let
          318|             evalNext = x: mapAny (depth + 1) (transform (depth + 1) x);
             |                                               ^
          319|           in

       … while calling 'id'
         at /nix/store/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-source/lib/trivial.nix:36:8:
           35|   */
           36|   id = x: x;
             |        ^
           37|

       … from call site
         at /nix/store/77nbmwc1lqzc1cp1q8jl6z10z2q9b17p-source/modules/plugins/lsp/config.nix:34:13:
           33|           ${mkBinding mappings.goToType "vim.lsp.buf.type_definition()"}
           34|           ${mkBinding mappings.listImplementations "vim.lsp.buf.implementation()"}
             |             ^
           35|           ${mkBinding mappings.listReferences "vim.lsp.buf.references()"}

       … while calling 'mkBinding'
         at /nix/store/77nbmwc1lqzc1cp1q8jl6z10z2q9b17p-source/modules/plugins/lsp/config.nix:19:24:
           18|   mappings = addDescriptionsToMappings cfg.mappings mappingDefinitions;
           19|   mkBinding = binding: action: "vim.api.nvim_buf_set_keymap(bufnr, 'n', '${binding.value}', '<cmd>lua ${action}<CR>', {noremap=true, silent=true, desc='${binding.description}'})";
             |                        ^
           20| in {

       … while evaluating a path segment
         at /nix/store/77nbmwc1lqzc1cp1q8jl6z10z2q9b17p-source/modules/plugins/lsp/config.nix:19:74:
           18|   mappings = addDescriptionsToMappings cfg.mappings mappingDefinitions;
           19|   mkBinding = binding: action: "vim.api.nvim_buf_set_keymap(bufnr, 'n', '${binding.value}', '<cmd>lua ${action}<CR>', {noremap=true, silent=true, desc='${binding.description}'})";
             |                                                                          ^
           20| in {

       error: cannot coerce null to a string: null
NotAShelf commented 4 months ago

This is to be expected, the function used for setting keybinds does not handle null cases. I can add a handler for that, but I am not sure if I want to support unsetting binds rather than overriding.

horriblename commented 4 months ago

what's the problem with unsetting? I can see it being useful, with how easy it is to end up with keybinds that conflict with defaults

FrothyMarrow commented 4 months ago

@NotAShelf @horriblename It is expected to handle null cases as we support null mappings for every other module. The issue here is that it doesn't use genMaps like other modules which filters them out. We don't use vim.maps.* because mappings are conditionally activated on LSP attach.

I made a PR to add the check.