Skip to content
This repository has been archived by the owner on Jan 25, 2024. It is now read-only.

Flake currently broken? #74

Closed
NobbZ opened this issue Dec 27, 2021 · 8 comments
Closed

Flake currently broken? #74

NobbZ opened this issue Dec 27, 2021 · 8 comments
Labels
bug Something isn't working question Further information is requested

Comments

@NobbZ
Copy link

NobbZ commented Dec 27, 2021

Describe the bug

When trying to run the LSP from flake, it produces some attribute missing error.

Steps to reproduce

$ nix run github:nix-community/rnix-lsp/master                                            error: attribute 'package' missing                                                        
       at /nix/store/dnzj42036l08pn9xwzgax8nbn2kk504s-source/lib/attrsets.nix:256:23:

          255|   mapAttrsToList = f: attrs:
          256|     map (name: f name attrs.${name}) (attrNames attrs);
             |                       ^
          257|
(use '--show-trace' to show detailed location information)

Expected behavior

The LSP starts.

Screenshots

Additional context

  • Version of rnix-lsp: master branch, tried for 2 days, though not close to a computer powerful enough to bisect.
  • Name and version of the editor you've used: none
  • Operating system: nixos
@NobbZ NobbZ added the bug Something isn't working label Dec 27, 2021
@Ma27
Copy link
Member

Ma27 commented Dec 27, 2021

master branch, tried for 2 days, though not close to a computer powerful enough to bisect.

Which rev are you on? Which Nix version do you use?

For me this seems to work fine with Nix 2.4:

λ ma27 [~] → nix run github:nix-community/rnix-lsp/master <<< 'invalid command'
[2021-12-27T10:02:26Z ERROR rnix_lsp] Error: expected initialize request, got Err(RecvError) (ProtocolError("expected initialize request, got Err(RecvError)"))
[2021-12-27T10:02:26Z ERROR rnix_lsp] A fatal error has occured and rnix-lsp will shut down.

@NobbZ
Copy link
Author

NobbZ commented Dec 27, 2021

Hmmm. I haven't considered the nix version being an issue, as other things work with nix run.

$ nix --version
nix (Nix) 2.6.0pre20211223_af553b2

Also it's not just nix run that fails with rnix lsp for me, I also was unable to use it from my system configuration. It failed to build there with the same error.

When I do a show trace though, I see a lot of toml related stuff. I'll try to get some output later today, but that's not easy from mobile via SSH.

@Ma27
Copy link
Member

Ma27 commented Dec 27, 2021

Just compiled Nix at af553b20902b8b8efbccab5f880879b09e95eb32, still getting no error though:

[ma27@carsten:~/Projects/nix]$ ./outputs/out/bin/nix run github:nix-community/rnix-lsp/master <<< 'invalid command' --experimental-features 'nix-command flakes'
[2021-12-27T12:01:44Z ERROR rnix_lsp] Error: expected initialize request, got Err(RecvError) (ProtocolError("expected initialize request, got Err(RecvError)"))
[2021-12-27T12:01:44Z ERROR rnix_lsp] A fatal error has occured and rnix-lsp will shut down.

A trace would be helpful indeed, isn't --show-trace sufficient?

@NobbZ
Copy link
Author

NobbZ commented Dec 27, 2021

It's sufficient, though copy and paste capabilities are limited using juice SSH

@NobbZ
Copy link
Author

NobbZ commented Dec 28, 2021

I was able to get my hands on a proper laptop:

$ nix run github:nix-community/rnix-lsp/master --show-trace
error: attribute 'package' missing

       at /nix/store/dnzj42036l08pn9xwzgax8nbn2kk504s-source/lib/attrsets.nix:256:23:

          255|   mapAttrsToList = f: attrs:
          256|     map (name: f name attrs.${name}) (attrNames attrs);
             |                       ^
          257|

       … while evaluating the attribute 'v'

       at /nix/store/chxlzsmkfbccnwinlwwm1smgwh3q75dr-source/builtins/to-toml.nix:130:44:

          129|         )
          130|         {} (mapAttrsToList (k: v: { inherit k v; }) attrs);
             |                                            ^
          131|     in

       … while evaluating 'tomlTy'

       at /nix/store/chxlzsmkfbccnwinlwwm1smgwh3q75dr-source/builtins/to-toml.nix:102:12:

          101|
          102|   tomlTy = x:
             |            ^
          103|     if typeOf x == "string" then "string" else

       … from call site

       at /nix/store/chxlzsmkfbccnwinlwwm1smgwh3q75dr-source/builtins/to-toml.nix:126:20:

          125|             let
          126|               ty = tomlTy x.v;
             |                    ^
          127|             in

       … while evaluating anonymous lambda

       at /nix/store/chxlzsmkfbccnwinlwwm1smgwh3q75dr-source/builtins/to-toml.nix:124:16:

          123|         (
          124|           acc: x:
             |                ^
          125|             let

       … from call site

       at /nix/store/dnzj42036l08pn9xwzgax8nbn2kk504s-source/lib/lists.nix:85:14:

           84|         then nul
           85|         else op (foldl' (n - 1)) (elemAt list n);
             |              ^
           86|     in foldl' (length list - 1);

       … while evaluating 'foldl''

       at /nix/store/dnzj42036l08pn9xwzgax8nbn2kk504s-source/lib/lists.nix:82:16:

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

       … from call site

       at /nix/store/dnzj42036l08pn9xwzgax8nbn2kk504s-source/lib/lists.nix:85:18:

           84|         then nul
           85|         else op (foldl' (n - 1)) (elemAt list n);
             |                  ^
           86|     in foldl' (length list - 1);

       … while evaluating anonymous lambda

       at /nix/store/chxlzsmkfbccnwinlwwm1smgwh3q75dr-source/builtins/to-toml.nix:124:16:

          123|         (
          124|           acc: x:
             |                ^
          125|             let

       … from call site

       at /nix/store/dnzj42036l08pn9xwzgax8nbn2kk504s-source/lib/lists.nix:85:14:

           84|         then nul
           85|         else op (foldl' (n - 1)) (elemAt list n);
             |              ^
           86|     in foldl' (length list - 1);

       … while evaluating 'foldl''

       at /nix/store/dnzj42036l08pn9xwzgax8nbn2kk504s-source/lib/lists.nix:82:16:

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

       … from call site

       at /nix/store/dnzj42036l08pn9xwzgax8nbn2kk504s-source/lib/lists.nix:86:8:

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

       … while evaluating 'foldl'

       at /nix/store/dnzj42036l08pn9xwzgax8nbn2kk504s-source/lib/lists.nix:80:20:

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

       … from call site

       at /nix/store/chxlzsmkfbccnwinlwwm1smgwh3q75dr-source/builtins/to-toml.nix:122:14:

          121|     let
          122|       byTy = lib.foldl
             |              ^
          123|         (

       … while evaluating 'concatMapStringsSep'

       at /nix/store/dnzj42036l08pn9xwzgax8nbn2kk504s-source/lib/strings.nix:110:5:

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

       … from call site

       at /nix/store/chxlzsmkfbccnwinlwwm1smgwh3q75dr-source/builtins/to-toml.nix:132:7:

          131|     in
          132|       concatMapStringsSep "\n"
             |       ^
          133|         (kv: concatStringsSep "\n" (outputKeyVal kv.k kv.v))

       … while evaluating 'toTOML'

       at /nix/store/chxlzsmkfbccnwinlwwm1smgwh3q75dr-source/builtins/to-toml.nix:119:12:

          118|
          119|   toTOML = attrs:
             |            ^
          120|     assert (typeOf attrs == "set");

       … from call site

       at /nix/store/chxlzsmkfbccnwinlwwm1smgwh3q75dr-source/builtins/default.nix:11:44:

           10|   toTOML = import ./to-toml.nix { inherit lib; };
           11|   writeTOML = name: attrs: writeText name (toTOML attrs);
             |                                            ^
           12|

       … while evaluating the attribute 'text' of the derivation 'Cargo.lock'

       at /nix/store/dnzj42036l08pn9xwzgax8nbn2kk504s-source/pkgs/stdenv/generic/make-derivation.nix:201:11:

          200|         // (lib.optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) {
          201|           name =
             |           ^
          202|             let

       … while evaluating the attribute 'buildCommand' of the derivation 'dummy-src'

       at /nix/store/dnzj42036l08pn9xwzgax8nbn2kk504s-source/pkgs/stdenv/generic/make-derivation.nix:201:11:

          200|         // (lib.optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) {
          201|           name =
             |           ^
          202|             let

       … while evaluating the attribute 'src' of the derivation 'rust-package-deps-unknown'

       at /nix/store/dnzj42036l08pn9xwzgax8nbn2kk504s-source/pkgs/stdenv/generic/make-derivation.nix:201:11:

          200|         // (lib.optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) {
          201|           name =
             |           ^
          202|             let

       … while evaluating the attribute 'builtDependencies' of the derivation 'rust-package-unknown'

       at /nix/store/dnzj42036l08pn9xwzgax8nbn2kk504s-source/pkgs/stdenv/generic/make-derivation.nix:201:11:

          200|         // (lib.optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) {
          201|           name =
             |           ^
          202|             let

@NobbZ
Copy link
Author

NobbZ commented Dec 29, 2021

I'm wondering if this might be directly or indirectly related to NixOS/nix#5609?

When I tried for the last time nixpkgs was pinned to https://github.com/NixOS/nixpkgs/tree/cb372c3b8880e504b06946e8fb2ca9777c685505.

$ nix registry list | grep nixpkgs
system flake:nixpkgs path:/nix/store/m6p4m1rs0xi67kaa25bm1rqkm4633qjr-source?lastModified=1640408860&narHash=sha256-h2uF3+a8bVfM8SjcS4hLbsOzOuG3qsxuImC0BucWs1Q=&rev=cb372c3b8880e504b06946e8fb2ca9777c685505
system flake:nixpkgs2105 path:/nix/store/nbl5ii6p176l1ndvc9z0h66pmsrgc71q-source?lastModified=1640283157&narHash=sha256-6Ddfop+rKE+Gl9Tjp9YIrkfoYPzb8F80ergdjcq3%2fMY=&rev=dde1557825c5644c869c5efc7448dc03722a8f09
system flake:nixpkgs2111 path:/nix/store/0c0029r6i05g8dihvwy2vgz7ffyrpibz-source?lastModified=1640443850&narHash=sha256-s3EhD+iNjyIE%2fgZkV5vES6d0eI4dJ2WBlaXyUsEmaek=&rev=6979c0e49bb491e18dd4870abb104cc7375aa7e8
global flake:nixpkgs github:NixOS/nixpkgs/nixpkgs-unstable

I'm fine with trying different pinned commits of nixpkgs to see whether or not this changes anything. Can you suggest some?

@Ma27
Copy link
Member

Ma27 commented Jan 17, 2022

@NobbZ is there anything actionable for us to do?

@NobbZ
Copy link
Author

NobbZ commented Jan 17, 2022

I'm not really sure currently. It seems as if I am the only one having this problem.

I'd say let's close for now.

@Ma27 Ma27 closed this as completed Jan 17, 2022
@Ma27 Ma27 added the question Further information is requested label Jan 17, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants