tirimia / neovim-nix

Flake for testing out versions of Neovim
GNU General Public License v3.0
5 stars 0 forks source link

Embedded terminal is broken in nvim installed through bob when used in outdated dev shell (I think?) #6

Closed Hubro closed 8 months ago

Hubro commented 9 months ago

Sorry this is a weird one, and I'm not good enough with Nix to reproduce it. Feel free to close this as stupid.

I was just stuck for a while with nvim installed through bob from this flake.

In one of my projects, any terminal I opened inside nvim (:term) would be completely broken. It would be flooded with glibc errors (dynamic linker errors I assume):

dirname: /nix/store/ld03l52xq2ssn4x0g5asypsxqls40497-glibc-2.37-8/lib/libc.so.6: version `GLIBC_2.38' not found (required by /run/current-system/sw/share/nix-ld/lib/libacl.so.1)
mkdir: /nix/store/ld03l52xq2ssn4x0g5asypsxqls40497-glibc-2.37-8/lib/libc.so.6: version `GLIBC_2.38' not found (required by /run/current-system/sw/share/nix-ld/lib/libacl.so.1)
tty: /nix/store/ld03l52xq2ssn4x0g5asypsxqls40497-glibc-2.37-8/lib/libc.so.6: version `GLIBC_2.38' not found (required by /run/current-system/sw/share/nix-ld/lib/libacl.so.1)

$ ls
ls: /nix/store/ld03l52xq2ssn4x0g5asypsxqls40497-glibc-2.37-8/lib/libc.so.6: version `GLIBC_2.38' not found (required by /run/current-system/sw/share/nix-ld/lib/libacl.so.1)

This project uses a flake.nix to set up some development dependencies for the project, as well as this direnv .envrc file:

if ! has nix_direnv_version || ! nix_direnv_version 2.3.0; then
  source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/2.3.0/direnvrc" "sha256-Dmd+j63L84wuzgyjITIfSxSD57Tx7v51DMxVZOsiUD8="
fi

nix_direnv_watch_file flake.nix
use flake path:.

This is the flake.nix file in question, in case it matters:

{
  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
  };
  outputs = { self, nixpkgs }:
    let
      system = "x86_64-linux";
      pkgs = nixpkgs.legacyPackages.${system};
    in
    {
      devShells.${system}.default = pkgs.mkShell {
        buildInputs = [
          pkgs.act
          pkgs.yamlfmt
        ];
      };
    };
}

Only nvim installed through bob had this issue. Using a version directly (from the same flake) worked fine. Using the system version worked fine.

What finally fixed the issue was deleting the flake lock and .direnv/ cache and reentering the directory, so I'm assuming the issue was that the environment set up by the flake was outdated in comparison to my system.

After figuring out the solution, this wasn't a big issue for me. However, if I was dependent on a specific nixpkgs version for the project, this would be a very big issue.

I'm just opening this in case you can easily divine what the issue is and it's a trivial fix. Feel free to close.

tirimia commented 9 months ago

I've experienced errors like that in the past; in my case they were caused by spectrwm overriding the PATH of spawned processes, so very likely it was something messing with the PATH. Since the shells started by the nix direnv tool are impure, not sure what I can do to reproducibly figure out where the issue was. Deleting the direnv cache was for sure a good step, but did you try it with a clean cache before deleting the flake lock ?

On an unrelated note: judging by your shell dependencies, you're writing GitHub Actions workflows; I wholeheartedly recommend using actionlint, it's a lifesaver and conveniently packaged for nix

Hubro commented 9 months ago

Deleting the direnv cache was for sure a good step, but did you try it with a clean cache before deleting the flake lock ?

Yep, just clearing the cache was not enough. Seems like the source of the problem was the flake lock.

On an unrelated note: judging by your shell dependencies, you're writing GitHub Actions workflows; I wholeheartedly recommend using actionlint, it's a lifesaver and conveniently packaged for nix

That looks awesome, thanks for the tip!

tirimia commented 8 months ago

Going to close as I can't reproduce it :(