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

[BUG] nixd: Failed to decode attrset/optionComplete #2604

Open
1 task done
UnReversed opened this issue Dec 3, 2024 · 4 comments
Open
1 task done

[BUG] nixd: Failed to decode attrset/optionComplete #2604

UnReversed opened this issue Dec 3, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@UnReversed
Copy link

UnReversed commented Dec 3, 2024

Field Description
Plugin none
Nixpkgs unstable
Home Manager unstable
  • I have read the FAQ and my bug is not listed there.

Description

when starting typing programs.nixvim. nixd started throwing errors instead autosuggesting

E[01:38:24.740] 290347: option worker reported: -32001: attrname nixvim not found in attrset
I[01:38:24.740] 290347: --> call attrset/optionComplete(51)
I[01:38:24.742] 290347: <-- reply(51)
E[01:38:24.742] 290347: Failed to decode attrset/optionComplete reply: unresolvable URI at (root)[4].Description.Declarations[0].uri
E[01:38:24.742] 290347: option worker reported: -32602: failed to decode attrset/optionComplete reply: unresolvable URI at (root)[4].Description.Declarations[0].uri
I[01:38:24.742] 290347: --> call attrset/optionComplete(50)
I[01:38:24.743] 290347: <-- reply(50)
E[01:38:24.743] 290347: option worker reported: -32001: attrname programs not found in attrset

checking it out more with nix repl ( (outputs.nixosConfigurations.reno.options.programs.nixvim.type.getSubOptions []) ) i thinks it breaks down with printInitPackage attribute (? still new to nix) because trying with multitude of word combinations i pinpoint this to attributes starting with p and rest of them (package,path,performance and plugins) in the end were autosuggested

there is still some chance that i setup nixd <-> nixvim badly (based on this issue)

Minimal, Reproducible Example (MRE)

my repo with MRE branch nixvim added as nixos module

programs.nixvim = {
     enable = true;
     p <- at this stage nixd throws error
}

EDIT affected branch

@UnReversed UnReversed added the bug Something isn't working label Dec 3, 2024
@MattSturgeon
Copy link
Member

MattSturgeon commented Dec 3, 2024

I wonder if this is related to the option prefix path?

E.g. does it work if you use getSubOptions ["programs" "nixvim"] instead of an empty prefix?

Though the fact this is an error and not just failing to find completions seems like a nixd bug that may need reporting upstream 🫠

@UnReversed
Copy link
Author

with outputs.nixosConfigurations.reno.options.programs.nixvim.type.getSubOptions ["programs" "nixvim"] nix repl works but nixd throws the same error

so report that upstream?

@MattSturgeon
Copy link
Member

MattSturgeon commented Dec 3, 2024

In your config, you're using the nixvim home-manager module, but in this issue you're accessing it as a nixos module option.

You'll need to access nixvim's options via your home-manager options. E.g.

"(${options}.home-manager.users.type.getSubOptions []).programs.nixvim.type.getSubOptions []"

or

"(${options}.home-manager.users.type.getSubOptions []).programs.nixvim.type.getSubOptions [\"programs\" \"nixvim\"]"

(This may also rely on nixvim's hm module being in home-manager's "shared" modules, rather than an import specific to your user)

You can see how I do this with less repeated code here: https://github.com/MattSturgeon/nix-config/blob/5dd1b19bc69fa33bfc950c10083490187c3d58a2/nvim/config/lsp.nix#L24-L48

@UnReversed
Copy link
Author

UnReversed commented Dec 3, 2024

First of all thanks for config because in the end i wanted to use it as home-manager module but couldn't find configs how to setup

In your config, you're using the nixvim home-manager module, but in this issue you're accessing it as a nixos module option.

i started from this config but i couldn't find config to make it working with nixd so i add nixvim.nixosModule then i notice errors metioned earlier so i disable home-manager nixvim module thinking it could clash somehow

before creating issued i created branch in my config mre/nixvim_03.13.2024 where this persist and there is only nixvim.nixosModule enabled

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants