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

sql-formatter cannot be found in pkgs. #2547

Open
ShadowReaper420 opened this issue Nov 19, 2024 · 3 comments
Open

sql-formatter cannot be found in pkgs. #2547

ShadowReaper420 opened this issue Nov 19, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@ShadowReaper420
Copy link

Field Description
Plugin <N/A
Nixpkgs Unstable
Home Manager Unstable
  programs.nixvim = {
    enable = true;
  };

Hi I am currently trying this out for my config and when I went to enable it I got this error

error:
       … while calling the 'head' builtin

         at /nix/store/fpivx4sjcp2vk4rp9nhliln5cwcp3kc6-source/lib/attrsets.nix:1575:11:

         1574|         || pred here (elemAt values 1) (head values) then
         1575|           head values
             |           ^
         1576|         else

       … while evaluating the attribute 'value'

         at /nix/store/fpivx4sjcp2vk4rp9nhliln5cwcp3kc6-source/lib/modules.nix:821:9:

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

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

       error: sql-formatter cannot be found in pkgs
┏━ 1 Errors: 
┃ error:
┃        … while calling the 'head' builtin
┃ 
┃          at /nix/store/fpivx4sjcp2vk4rp9nhliln5cwcp3kc6-source/lib/attrsets.nix:1575:11:
┃ 
┃          1574|         || pred here (elemAt values 1) (head values) then
┃          1575|           head values
┃              |           ^
┃          1576|         else
┃ 
┃        … while evaluating the attribute 'value'
┃ 
┃          at /nix/store/fpivx4sjcp2vk4rp9nhliln5cwcp3kc6-source/lib/modules.nix:821:9:
┃ 
┃           820|     in warnDeprecation opt //
┃           821|       { value = addErrorContext "while evaluating the option `${showOption loc}':" value;
┃              |         ^
┃           822|         inherit (res.defsFinal') highestPrio;
┃ 
┃        (stack trace truncated; use '--show-trace' to show the full trace)
┃ 
┃        error: sql-formatter cannot be found in pkgs
┣━━━                                                             
┗━ ∑ ⚠ Exited with 1 errors reported by nix at 08:31:05 after 10s
Error: 

   0: Command exited with status Exited(1)

I checked nixpkgs and it seems the package for sql-formatter got renamed recently although I'm not sure why it needs this by default.

@ShadowReaper420 ShadowReaper420 added the bug Something isn't working label Nov 19, 2024
@ShadowReaper420 ShadowReaper420 changed the title sql-formatter cannot be found in pkgs [BUG] <BUG> sql-formatter cannot be found in pkgs. Nov 19, 2024
@MattSturgeon
Copy link
Member

What branch/channel are you following for nixpkgs and nixvim respectively?

These kinda issues usually occurs when you have a different nixpkgs version to the one we're using in our flake.lock. That could mean you're a few days out of sync with us, a few months, or perhaps even on an entirely different branch 😁

@ShadowReaper420
Copy link
Author

ShadowReaper420 commented Nov 19, 2024

I'm using flakes and nixvim is following the unstable branch.
So

inputs = {
  nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
  
  nixvim = {
    url = github:nix-community/nixvim;
    inputs.nixpkgs.follows = "nixpkgs";
  };
};

I'm too lazy to make this look nice

@MattSturgeon
Copy link
Member

MattSturgeon commented Nov 19, 2024

First thing to check, depending on how you're using nixvim, removing the follows line may allow nixvim to use the version of nixpkgs it wants to.

However most of the time, nixvim will use the pkgs module arg already available in the "hosting" modules.

One brute force way you can ensure you're using the same as us is to do:

nix flake lock --override-input nixpkgs github:NixOS/nixpkgs/5e4fbfb6b3de1aa2872b76d49fafc942626e2add

(5e4fbfb6 is the nixpkgs rev currently in our lock file):

nixvim/flake.lock

Lines 189 to 204 in c674f10

"nixpkgs": {
"locked": {
"lastModified": 1731676054,
"narHash": "sha256-OZiZ3m8SCMfh3B6bfGC/Bm4x3qc1m2SVEAlkV6iY7Yg=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "5e4fbfb6b3de1aa2872b76d49fafc942626e2add",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},

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