oxalica / nil

NIx Language server, an incremental analysis assistant for writing in Nix.
Apache License 2.0
1.38k stars 40 forks source link

Error when opening a Nix file #78

Closed RaitoBezarius closed 1 year ago

RaitoBezarius commented 1 year ago

With the recent nixpkgs bump of nil, I'm getting:

LSP[nil_ls] Failed to evaluate NixOS options: Nix eval failed with exit status: 1. Stderr:                                                                            
error: attribute 'renderOptionValue' missing                                                                                                                          
       at «string»:5:4:                                                                                                                                               
            4| nixpkgs:                                                                                                                                               
            5| let                                                                                                                                                    
             |    ^                                                                                                                                                   
            6|   lib = import (nixpkgs + "/lib");

while opening files which does not have any nixpkgs relation.

Does it ring a bell?

oxalica commented 1 year ago

The error is triggered when it tries to load nixpkgs flake input. Do you have an input named nixpkgs but is not a recent enough nixpkgs?

d4ilyrun commented 1 year ago

Did you try running nix flake archive?

oxalica commented 1 year ago

Did you try running nix flake archive?

Should not be relevant. The failed Nix is at https://github.com/oxalica/nil/blob/2023-05-02/crates/nix-interop/src/nixos_options.nix which is used to dump all NixOS options for the flake input named "nixpkgs".

RaitoBezarius commented 1 year ago

The error is triggered when it tries to load nixpkgs flake input. Do you have an input named nixpkgs but is not a recent enough nixpkgs?

I personally don't use flakes so I don't really know where does this input would come from neither what is its freshness, I opened this in the NixOS/Ofborg repository (maintainers.nix).

How could I debug this further?

oxalica commented 1 year ago

in the NixOS/Ofborg repository

Oh it uses nixos-22.11. We should somehow check the revision of a dumped nixpkgs before the evaluation, but I have no clear idea.