nvim-neorg / tree-sitter-norg

A TreeSitter parser for the Neorg File Format
MIT License
99 stars 14 forks source link

[nixos] attribute 'name' missing #40

Closed johanneshorner closed 1 year ago

johanneshorner commented 2 years ago

Using the latest nixpkgs-neorg-overlay flake results in "error: attribute 'name' missing' (full '--show-trace' output attached).

Pinning the inputs "norg" and "norg-meta" to the commits preceding Define outputs for each system and Define outputs for each system respectively, fixes the issue.

neorg-overlay = {
    url = "github:nvim-neorg/nixpkgs-neorg-overlay";
    inputs.nixpkgs.follows = "nixpkgs";
    inputs.norg.url = "github:nvim-neorg/tree-sitter-norg?rev=5d9c76b5c9927955f7c5d5d946397584e307f69f";
    inputs.norg-meta.url = "github:nvim-neorg/tree-sitter-norg-meta?rev=e93dcbc56a472649547cfc288f10ae4a93ef8795";
};

I'm happy to debug this further on my machine but I'll need some help as I don't have that much experience with nix yet.

@bandithedoge @pschyska

trace.txt

bandithedoge commented 2 years ago

Please post the entire output with --show-trace. Also try removing inputs.nixpkgs.follows = "nixpkgs"; since you might be using a different version of nixpkgs.

johanneshorner commented 2 years ago

Removing inputs.nixpkgs.follows = "nixpkgs"; did not help. I did attach the trace as a file in the issue but here is another one with the inputs.nixpkgs.follows = "nixpkgs"; line removed:

warning: Git tree '/home/johannes/dev/nix-config' is dirty
warning: Git tree '/home/johannes/dev/nix-config' is dirty
error: attribute 'name' missing

       at /nix/store/z59rm6q29zvd8sb1hs305bjpy9wb5bzk-source/lib/strings.nix:629:30:

          628|       then parse x
          629|       else x.pname or (parse x.name);
             |                              ^
          630|

       … while evaluating 'parse'

       at /nix/store/z59rm6q29zvd8sb1hs305bjpy9wb5bzk-source/lib/strings.nix:626:14:

          625|    let
          626|      parse = drv: (parseDrvName drv).name;
             |              ^
          627|    in if isString x

       … from call site

       at /nix/store/z59rm6q29zvd8sb1hs305bjpy9wb5bzk-source/lib/strings.nix:629:24:

          628|       then parse x
          629|       else x.pname or (parse x.name);
             |                        ^
          630|

       … while evaluating 'getName'

       at /nix/store/z59rm6q29zvd8sb1hs305bjpy9wb5bzk-source/lib/strings.nix:624:13:

          623|   */
          624|   getName = x:
             |             ^
          625|    let

       … from call site

       at /nix/store/z59rm6q29zvd8sb1hs305bjpy9wb5bzk-source/pkgs/development/tools/parsing/tree-sitter/default.nix:93:20:

           92|           let
           93|             name = lib.strings.getName drv;
             |                    ^
           94|           in

       … while evaluating 'removeSuffix'

       at /nix/store/z59rm6q29zvd8sb1hs305bjpy9wb5bzk-source/lib/strings.nix:582:5:

          581|     # Input string
          582|     str:
             |     ^
          583|     let

       … from call site

       at /nix/store/z59rm6q29zvd8sb1hs305bjpy9wb5bzk-source/pkgs/development/tools/parsing/tree-sitter/default.nix:99:20:

           98|                 (lib.strings.removePrefix "tree-sitter-"
           99|                   (lib.strings.removeSuffix "-grammar" name)))
             |                    ^
          100|               + ".so";

       … while evaluating 'hasPrefix'

       at /nix/store/z59rm6q29zvd8sb1hs305bjpy9wb5bzk-source/lib/strings.nix:229:5:

          228|     # Input string
          229|     str: substring 0 (stringLength pref) str == pref;
             |     ^
          230|

       … from call site

       at /nix/store/z59rm6q29zvd8sb1hs305bjpy9wb5bzk-source/lib/strings.nix:563:10:

          562|     in
          563|       if hasPrefix prefix str then
             |          ^
          564|         substring preLen (sLen - preLen) str

       … while evaluating 'removePrefix'

       at /nix/store/z59rm6q29zvd8sb1hs305bjpy9wb5bzk-source/lib/strings.nix:558:5:

          557|     # Input string
          558|     str:
             |     ^
          559|     let

       … from call site

       at /nix/store/z59rm6q29zvd8sb1hs305bjpy9wb5bzk-source/pkgs/development/tools/parsing/tree-sitter/default.nix:98:18:

           97|               (lib.strings.replaceStrings [ "-" ] [ "_" ]
           98|                 (lib.strings.removePrefix "tree-sitter-"
             |                  ^
           99|                   (lib.strings.removeSuffix "-grammar" name)))

       … while evaluating the attribute 'name'

       at /nix/store/z59rm6q29zvd8sb1hs305bjpy9wb5bzk-source/pkgs/development/tools/parsing/tree-sitter/default.nix:96:13:

           95|           {
           96|             name =
             |             ^
           97|               (lib.strings.replaceStrings [ "-" ] [ "_" ]

       … while evaluating 'escapeShellArg'

       at /nix/store/z59rm6q29zvd8sb1hs305bjpy9wb5bzk-source/lib/strings.nix:354:20:

          353|   */
          354|   escapeShellArg = arg: "'${replaceStrings ["'"] ["'\\''"] (toString arg)}'";
             |                    ^
          355|

       … from call site

       at /nix/store/z59rm6q29zvd8sb1hs305bjpy9wb5bzk-source/pkgs/build-support/trivial-builders.nix:489:33:

          488|       ${lib.concatMapStrings (x: ''
          489|           mkdir -p "$(dirname ${lib.escapeShellArg x.name})"
             |                                 ^
          490|           ln -s ${lib.escapeShellArg "${x.path}"} ${lib.escapeShellArg x.name}

       … while evaluating anonymous lambda

       at /nix/store/z59rm6q29zvd8sb1hs305bjpy9wb5bzk-source/pkgs/build-support/trivial-builders.nix:488:31:

          487|       cd $out
          488|       ${lib.concatMapStrings (x: ''
             |                               ^
          489|           mkdir -p "$(dirname ${lib.escapeShellArg x.name})"

       … from call site

       … while evaluating 'concatMapStrings'

       at /nix/store/z59rm6q29zvd8sb1hs305bjpy9wb5bzk-source/lib/strings.nix:54:25:

           53|   */
           54|   concatMapStrings = f: list: concatStrings (map f list);
             |                         ^
           55|

       … from call site

       at /nix/store/z59rm6q29zvd8sb1hs305bjpy9wb5bzk-source/pkgs/build-support/trivial-builders.nix:488:9:

          487|       cd $out
          488|       ${lib.concatMapStrings (x: ''
             |         ^
          489|           mkdir -p "$(dirname ${lib.escapeShellArg x.name})"

       … while evaluating the attribute 'buildCommand' of the derivation 'grammars'

       at /nix/store/z59rm6q29zvd8sb1hs305bjpy9wb5bzk-source/pkgs/stdenv/generic/make-derivation.nix:270:7:

          269|     // (lib.optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) {
          270|       name =
             |       ^
          271|         let

       … while evaluating the attribute 'postPatch' of the derivation 'vimplugin-nvim-treesitter-2022-10-20'

       at /nix/store/z59rm6q29zvd8sb1hs305bjpy9wb5bzk-source/pkgs/stdenv/generic/make-derivation.nix:270:7:

          269|     // (lib.optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) {
          270|       name =
             |       ^
          271|         let

       … while evaluating anonymous lambda

       at /nix/store/z59rm6q29zvd8sb1hs305bjpy9wb5bzk-source/lib/lists.nix:646:25:

          645|    */
          646|   unique = foldl' (acc: e: if elem e acc then acc else acc ++ [ e ]) [];
             |                         ^
          647|

       … from call site

       at /nix/store/z59rm6q29zvd8sb1hs305bjpy9wb5bzk-source/pkgs/applications/editors/vim/plugins/vim-utils.nix:188:20:

          187|       startWithDeps = findDependenciesRecursively start;
          188|       allPlugins = lib.unique (startWithDeps ++ depsOfOptionalPlugins);
             |                    ^
          189|       python3Env = python3.withPackages (ps:

       … while evaluating 'concatMapStrings'

       at /nix/store/z59rm6q29zvd8sb1hs305bjpy9wb5bzk-source/lib/strings.nix:54:25:

           53|   */
           54|   concatMapStrings = f: list: concatStrings (map f list);
             |                         ^
           55|

       … from call site

       at /nix/store/z59rm6q29zvd8sb1hs305bjpy9wb5bzk-source/pkgs/build-support/trivial-builders.nix:488:9:

          487|       cd $out
          488|       ${lib.concatMapStrings (x: ''
             |         ^
          489|           mkdir -p "$(dirname ${lib.escapeShellArg x.name})"

       … while evaluating the attribute 'buildCommand' of the derivation 'packdir-start'

       at /nix/store/z59rm6q29zvd8sb1hs305bjpy9wb5bzk-source/pkgs/stdenv/generic/make-derivation.nix:270:7:

          269|     // (lib.optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) {
          270|       name =
             |       ^
          271|         let

       … while evaluating the attribute 'passAsFile'

       at /nix/store/z59rm6q29zvd8sb1hs305bjpy9wb5bzk-source/pkgs/build-support/buildenv/default.nix:77:5:

           76|     # XXX: The size is somewhat arbitrary
           77|     passAsFile = if builtins.stringLength pkgs >= 128*1024 then [ "pkgs" ] else [ ];
             |     ^
           78|   }

       … while evaluating the attribute 'passAsFile' of the derivation 'vim-pack-dir'

       at /nix/store/z59rm6q29zvd8sb1hs305bjpy9wb5bzk-source/pkgs/stdenv/generic/make-derivation.nix:270:7:

          269|     // (lib.optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) {
          270|       name =
             |       ^
          271|         let

       … while evaluating 'escapeShellArg'

       at /nix/store/z59rm6q29zvd8sb1hs305bjpy9wb5bzk-source/lib/strings.nix:354:20:

          353|   */
          354|   escapeShellArg = arg: "'${replaceStrings ["'"] ["'\\''"] (toString arg)}'";
             |                    ^
          355|

       … from call site

       … while evaluating 'concatMapStringsSep'

       at /nix/store/z59rm6q29zvd8sb1hs305bjpy9wb5bzk-source/lib/strings.nix:111:5:

          110|     # List of input strings
          111|     list: concatStringsSep sep (map f list);
             |     ^
          112|

       … from call site

       at /nix/store/z59rm6q29zvd8sb1hs305bjpy9wb5bzk-source/pkgs/applications/editors/neovim/utils.nix:113:44:

          112|         [
          113|           "--inherit-argv0" "--add-flags" (lib.escapeShellArgs flags)
             |                                            ^
          114|         ] ++ lib.optionals withRuby [

       … while evaluating 'escapeShellArg'

       at /nix/store/z59rm6q29zvd8sb1hs305bjpy9wb5bzk-source/lib/strings.nix:354:20:

          353|   */
          354|   escapeShellArg = arg: "'${replaceStrings ["'"] ["'\\''"] (toString arg)}'";
             |                    ^
          355|

       … from call site

       … while evaluating 'concatMapStringsSep'

       at /nix/store/z59rm6q29zvd8sb1hs305bjpy9wb5bzk-source/lib/strings.nix:111:5:

          110|     # List of input strings
          111|     list: concatStringsSep sep (map f list);
             |     ^
          112|

       … from call site

       at /nix/store/k2fh619wq7s4f2fhr8ja0vp8k30f234k-source/modules/programs/neovim.nix:387:24:

          386|       (neovimConfig // {
          387|         wrapperArgs = (lib.escapeShellArgs neovimConfig.wrapperArgs) + " "
             |                        ^
          388|           + extraMakeWrapperArgs + " " + extraMakeWrapperLuaCArgs + " "

       … while evaluating 'optionalString'

       at /nix/store/z59rm6q29zvd8sb1hs305bjpy9wb5bzk-source/lib/strings.nix:213:5:

          212|     # String to return if condition is true
          213|     string: if cond then string else "";
             |     ^
          214|

       … from call site

       at /nix/store/z59rm6q29zvd8sb1hs305bjpy9wb5bzk-source/pkgs/applications/editors/neovim/wrapper.nix:75:9:

           74|       ''
           75|       + optionalString (manifestRc != null) (let
             |         ^
           76|         manifestWrapperArgs =

       … while evaluating the attribute 'buildCommand' of the derivation 'neovim-master'

       at /nix/store/z59rm6q29zvd8sb1hs305bjpy9wb5bzk-source/pkgs/stdenv/generic/make-derivation.nix:270:7:

          269|     // (lib.optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) {
          270|       name =
             |       ^
          271|         let

       … while evaluating the attribute 'passAsFile'

       at /nix/store/z59rm6q29zvd8sb1hs305bjpy9wb5bzk-source/pkgs/build-support/buildenv/default.nix:77:5:

           76|     # XXX: The size is somewhat arbitrary
           77|     passAsFile = if builtins.stringLength pkgs >= 128*1024 then [ "pkgs" ] else [ ];
             |     ^
           78|   }

       … while evaluating the attribute 'passAsFile' of the derivation 'home-manager-path'

       at /nix/store/z59rm6q29zvd8sb1hs305bjpy9wb5bzk-source/pkgs/stdenv/generic/make-derivation.nix:270:7:

          269|     // (lib.optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) {
          270|       name =
             |       ^
          271|         let

       … while evaluating the attribute 'value'

       at /nix/store/z59rm6q29zvd8sb1hs305bjpy9wb5bzk-source/lib/modules.nix:552:44:

          551|       defnsByName' = byName "config" (module: value:
          552|           [{ inherit (module) file; inherit value; }]
             |                                            ^
          553|         ) configs;

       … while evaluating 'dischargeProperties'

       at /nix/store/z59rm6q29zvd8sb1hs305bjpy9wb5bzk-source/lib/modules.nix:799:25:

          798|   */
          799|   dischargeProperties = def:
             |                         ^
          800|     if def._type or "" == "merge" then

       … from call site

       at /nix/store/z59rm6q29zvd8sb1hs305bjpy9wb5bzk-source/lib/modules.nix:728:137:

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

       … while evaluating definitions from `/nix/store/k2fh619wq7s4f2fhr8ja0vp8k30f234k-source/modules/home-environment.nix':

       … while evaluating anonymous lambda

       at /nix/store/z59rm6q29zvd8sb1hs305bjpy9wb5bzk-source/lib/modules.nix:727:28:

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

       … from call site

       at /nix/store/z59rm6q29zvd8sb1hs305bjpy9wb5bzk-source/lib/modules.nix:727:17:

          726|         # Process mkMerge and mkIf properties.
          727|         defs' = concatMap (m:
             |                 ^
          728|           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/z59rm6q29zvd8sb1hs305bjpy9wb5bzk-source/lib/modules.nix:840:7:

          839|     in {
          840|       values = concatMap (def: if getPrio def == highestPrio then [(strip def)] else []) defs;
             |       ^
          841|       inherit highestPrio;

       … while evaluating the attribute 'values'

       at /nix/store/z59rm6q29zvd8sb1hs305bjpy9wb5bzk-source/lib/modules.nix:741:9:

          740|       in {
          741|         values = defs''';
             |         ^
          742|         inherit (defs'') highestPrio;

       … while evaluating the attribute 'mergedValue'

       at /nix/store/z59rm6q29zvd8sb1hs305bjpy9wb5bzk-source/lib/modules.nix:747:5:

          746|     # Type-check the remaining definitions, and merge them. Or throw if no definitions.
          747|     mergedValue =
             |     ^
          748|       if isDefined then

       … while evaluating the option `home.activation.installPackages.data':

       … while evaluating the attribute 'value'

       at /nix/store/z59rm6q29zvd8sb1hs305bjpy9wb5bzk-source/lib/modules.nix:712:9:

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

       … while evaluating anonymous lambda

       at /nix/store/z59rm6q29zvd8sb1hs305bjpy9wb5bzk-source/lib/modules.nix:265:72:

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

       … from call site

       at /nix/store/z59rm6q29zvd8sb1hs305bjpy9wb5bzk-source/lib/attrsets.nix:401:20:

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

       … while evaluating 'g'

       at /nix/store/z59rm6q29zvd8sb1hs305bjpy9wb5bzk-source/lib/attrsets.nix:398:19:

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

       … from call site

       … while evaluating the attribute 'data'

       at /nix/store/k2fh619wq7s4f2fhr8ja0vp8k30f234k-source/modules/lib/dag.nix:83:9:

           82|         name = n;
           83|         data = v.data;
             |         ^
           84|         after = v.after ++ dagBefore dag n;

       … while evaluating the attribute 'data'

       at /nix/store/k2fh619wq7s4f2fhr8ja0vp8k30f234k-source/modules/lib/dag.nix:89:37:

           88|     in if sorted ? result then {
           89|       result = map (v: { inherit (v) name data; }) sorted.result;
             |                                     ^
           90|     } else

       … while evaluating 'mkCmd'

       at /nix/store/k2fh619wq7s4f2fhr8ja0vp8k30f234k-source/modules/home-environment.nix:638:17:

          637|       let
          638|         mkCmd = res: ''
             |                 ^
          639|             _iNote "Activating %s" "${res.name}"

       … from call site

       … while evaluating the attribute 'text' of the derivation 'activation-script'

       at /nix/store/z59rm6q29zvd8sb1hs305bjpy9wb5bzk-source/pkgs/stdenv/generic/make-derivation.nix:270:7:

          269|     // (lib.optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) {
          270|       name =
             |       ^
          271|         let

       … while evaluating the attribute 'buildCommand' of the derivation 'home-manager-generation'

       at /nix/store/z59rm6q29zvd8sb1hs305bjpy9wb5bzk-source/pkgs/stdenv/generic/make-derivation.nix:270:7:

          269|     // (lib.optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) {
          270|       name =
             |       ^
          271|         let

Also my neovim config if that helps (using the Neovim master branch overlay but it doesn't work with the 0.8.0 release version either) :

{ pkgs, lib, config, ... }: {
  home = {
    sessionVariables.EDITOR = "nvim";
    default-apps.editor = {
      cmd = config.home.default-apps.terminal.cmd-spawn "nvim";
    };
    file = {
      ".config/nvim".source = config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/dev/nix-config/home/.config/nvim";
    };
  };

  programs.neovim = {
    enable = true;
    package = pkgs.neovim;
    vimAlias = true;

    plugins = with pkgs.vimPlugins; [
      (nvim-treesitter.withPlugins (_: pkgs.tree-sitter.allGrammars))
      plenary-nvim
      playground
      nvim-dap
      nvim-dap-ui
      nvim-dap-virtual-text
      rust-tools-nvim
      neodev-nvim
      comment-nvim
      lsp_lines-nvim
      nvim-colorizer-lua
      indent-blankline-nvim
      nvim-lspconfig
      toggleterm-nvim
      lualine-nvim
      bufferline-nvim
      nvim-tree-lua
      neogit
      telescope-nvim
      telescope-fzf-native-nvim
      telescope-dap-nvim
      neorg-telescope
      telescope-manix
      neorg
      zk-nvim
      nvim-cmp
      cmp-buffer
      cmp-path
      luasnip
      cmp_luasnip
      cmp-nvim-lsp
      cmp-nvim-lsp-signature-help
      nvim-web-devicons
      gruvbox-nvim # colorscheme
      markdown-preview-nvim
      markid
      hologram-nvim
      # himalaya-vim
    ];
  };

  home.packages = with pkgs; [
    rnix-lsp
    rust-analyzer
    sumneko-lua-language-server
    python310Packages.jedi-language-server
    clang-tools
    nodePackages.typescript-language-server
    zls
    manix
  ];
}
pschyska commented 2 years ago

I have to admit I'm quite confused on why it fails for you. I don't use the overlay though, but this flake and tree-sitter-norg-meta directly, investigating...