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] error: Alias bash-language-server is still in node-packages.nix error when building on current nixos-unstable #1699

Closed
1 task done
Daru-san opened this issue Jun 14, 2024 · 18 comments
Labels
bug Something isn't working

Comments

@Daru-san
Copy link

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

Description

Every time I attempt to build nixvim on the current revision of nixpkgs on nixos-unstable, the error below is thrown.
I assumed that I had to disable bashls in the lsp options in order to fix this but that does not fix it

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

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

       … while evaluating attribute 'paths' of derivation 'nixvim'
         at /nix/store/fg9vjx7bl5yj0slbwgw1rjghmlvvi83f-source/wrappers/standalone.nix:52:7:
           51|       name = "nixvim";
           52|       paths = [
             |       ^
           53|         config.finalPackage

       … while evaluating the default value of option `plugins.lsp.servers.bashls.cmd`

       … while evaluating the option `plugins.lsp.servers.bashls.package':

       (stack trace truncated; use '--show-trace' to show the full, detailed trace)

       error: Alias bash-language-server is still in node-packages.nix

Minimal, Reproducible Example (MRE)

# This applies whether bashls is enabled or not
programs.nixvim = {
  plugins.lsp.servers.bashls.enable = true;
}
@Daru-san Daru-san added the bug Something isn't working label Jun 14, 2024
@MattSturgeon
Copy link
Collaborator

MattSturgeon commented Jun 14, 2024

The issue is we are using an old package name for the bash language server.

This should only affect you if you are overriding nixvim's nixpkgs lock (i.e. nixvim.inputs.nixpkgs.follows).

Until we fix this in See #1696, you should either remove/comment out your "nixvim follows" line, or rollback your flake.lock to an older nixpkgs revision.

EDIT: upstream PR is NixOS/nixpkgs#319882

@Amelia-Mowers
Copy link

Just had this and fixed this issue by removing nixvim.inputs.nixpkgs.follows but you have to also run nix flake update, or similar command to just update that one flake, as well. Which was not immediately obvious to me.

@MattSturgeon
Copy link
Collaborator

Just had this and fixed this issue by removing nixvim.inputs.nixpkgs.follows but you have to also run nix flake update, or similar command to just update that one flake, as well. Which was not immediately obvious to me.

If you want to apply input changes to flake.lock without also updating, you can use nix flake lock.

Incidentally, if you want to change what an input points to without modifying your flake.nix (e.g. to temporarily test a PR or revert to an old rev) you can use nix flake lock --override-input <input-name> <input-url>.

jalil-salame added a commit to jalil-salame/configuration.nix that referenced this issue Jun 14, 2024
See [nixvim/#1699][1] for context.

[1]: <nix-community/nixvim#1699>
@MattSturgeon MattSturgeon pinned this issue Jun 16, 2024
@niksingh710
Copy link
Contributor

niksingh710 commented Jun 16, 2024

i have only nixvim.url = "github:nix-community/nixvim"; in my inputs. it has been generated by nix flake init -t github:nix-community/nixvim i don't see any option where it is specified to be nixvim.inputs.nixpkgs.follows";

still having the same issue.

saitheninja added a commit to saitheninja/nixconfig that referenced this issue Jun 16, 2024
`error: Alias bash-language-server is still in node-packages.nix`
nix-community/nixvim#1699

bash-ls package was moved and the update hasn't reached nixos-unstable yet.
jwilger added a commit to jwilger/nixvim-config that referenced this issue Jun 16, 2024
@djacu
Copy link

djacu commented Jun 16, 2024

I was still getting the error after removing the "follows" line. I ended up pinning my nixpkgs input to the same rev as the nixpkgs input for nixvim and that worked fine as expected.

@bearfm
Copy link

bearfm commented Jun 16, 2024

I removed the 'follows' line from mine, went to the directory with my NixOS config, and ran sudo nix flake update , and then ran sudo nixos-rebuild --flake . switch --upgrade and it built with no issues.

@MattSturgeon
Copy link
Collaborator

I was still getting the error after removing the "follows" line

Did you run nix flake lock after removing the follows?

@MartinEekGerhardsen
Copy link

After removing the follows and running both nix flake update and nix flake lock multiple times, I still get the same build error. Is there any information I can provide to try to find a solution to this, or would it be easiest to wait for #1696?

@MattSturgeon
Copy link
Collaborator

MattSturgeon commented Jun 17, 2024

After removing the follows and running both nix flake update and nix flake lock multiple times, I still get the same build error.

If follows is not having an effect, try overriding your main nixpkgs input (the one that becomes pkgs in your modules) to point to a nixpkgs without this issue. We're currently locked to 57d6973abba7ea108bac64ae7629e7431e0199b6.

The upstream PR has made it to nixos-unstable-small, so that channel may also work (hopefully, anyway).

Is there any information I can provide to try to find a solution to this

I'm curious which installation method you use for nixvim (nixos, hm, darwin, standalone), it may be this determines whether nixvim evaluate using its own nixpkgs input or the pkgs of a wider module system.

@MartinEekGerhardsen
Copy link

MartinEekGerhardsen commented Jun 17, 2024

If follows is not having an effect, try overriding your main nixpkgs input (the one that becomes pkgs in your modules) to point to a nixpkgs without this issue. We're currently locked to 57d6973abba7ea108bac64ae7629e7431e0199b6.

Using this commit, I no longer get this error, both with and without follows. Thank you!

I'm curious which installation method you use for nixvim (nixos, hm, darwin, standalone), it may be this determines whether nixvim evaluate using its own nixpkgs input or the pkgs of a wider module system.

I'm using a standalone nixvim flake on my system running NixOS x86_64-linux and just add the output of the standalone flake to my system packages.

@meck
Copy link

meck commented Jun 17, 2024

I'm also seeing this where I got a custom nixvim flake that wraps nixvim this has

nixpkgs.follows = "nixvim/nixpkgs";

And just running nix run .# works. But if i add it to my nixos config which just have mvim.url = "github:meck/mvim" (no follow in the input) this error pops up as if it using the general nixos nixpkgs version, nixos-unstable.

@purepani
Copy link
Contributor

The update has now made it into nixpkgs. Now #1702 is stopping me from building, but this is a separate issue.

@MattSturgeon
Copy link
Collaborator

The update has now made it into nixpkgs. Now #1702 is stopping me from building, but this is a separate issue.

It's not yet in nixos-unstable. It's in all the other channels though: https://nixpk.gs/pr-tracker.html?pr=319882

nixos-unstable is currently 3 days behind master

@iSma
Copy link
Contributor

iSma commented Jun 17, 2024

Just curious, is there a reason why setting plugins.lsp.servers.bashls.enable = false; and/or overriding plugins.lsp.servers.bashls.package still triggers this issue? I had a quick look at _mk-lsp.nix and from my understanding package shouldn't get evaluated if enabled is false.

@MattSturgeon
Copy link
Collaborator

MattSturgeon commented Jun 17, 2024

Just curious, is there a reason why setting plugins.lsp.servers.bashls.enable = false; and/or overriding plugins.lsp.servers.bashls.package still triggers this issue? I had a quick look at _mk-lsp.nix and from my understanding package shouldn't get evaluated if enabled is false.

I haven't looked at this specific case, but NixOS modules often evaluate a lot of branches that might not get evaluated in non-module nix expressions. This is done to ensure more parts of your config are valid, even some parts you aren't using.

For instance, lib.mkIf isn't actually using if then else, instead it just returns an attrset with a condition attribute and a config attribute. The module system itself then evaluates the config, regardless of condition being successful. It just only gets merged into the final config if the condition was successful.

@dlip
Copy link
Contributor

dlip commented Jun 18, 2024

I suspect this might be due to home-manager.useGlobalPkgs = true; but is breaks too many things for me to confirm this

@GaetanLepage
Copy link
Collaborator

Fixed in #1719

@dlip
Copy link
Contributor

dlip commented Jun 19, 2024

Since I thought it might be of use to others, I fixed the nixpkg dependency overriding problem by removing the home manger module and just used nixvim as a standalone overlay. Getting extra plugins working was a little tricky:

I add it to my overlay and add my extraPluginsSrc vim plugin inputs to extraSpecialArgs. It uses a trick to get all the inputs starting with "vimplugin-", but you can just pass in an attrset manually if you like.

https://github.com/dlip/nixconfig/blob/e19874c0f1326390708f7003af4c2e07ecf3e45d/overlays/default.nix#L43-L48

I then build them using the nixpkgs in nixvim

https://github.com/dlip/nixconfig/blob/e19874c0f1326390708f7003af4c2e07ecf3e45d/overlays/nixvim/default.nix#L6-L12

And pass in to extraPlugins

https://github.com/dlip/nixconfig/blob/e19874c0f1326390708f7003af4c2e07ecf3e45d/overlays/nixvim/default.nix#L886-L890

then you can just use

home.packages = [ nixvim ];

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