mjlbach/starter.nvim

Infinite recursion error

Closed this issue · 9 comments

573 commented

I would love to use this template.

When NIX_PATH=nixpkgs=http://nixos.org/channels/nixpkgs-unstable/nixexprs.tar.xz nix-shell I'm getting

error: infinite recursion encountered, at /nix/store/2fry3p9f13z4icn9a973fwaj6n4hgnz1-source/contrib/flake.nix:98:18

This is my neovim overlay:

# file ~/.config/nixpkgs/overlays/neovim.nix
(import (builtins.fetchTarball {
      url = https://github.com/nix-community/neovim-nightly-overlay/archive/master.tar.gz;
    }))

Hmm it's not the template, but neovim-nightly-overlay which is causing the issue. Others have reported this too, but no one has filed an issue yet. nix shell should work on nixUnstable not sure why nix-shell on 2.3 is causing issues.

I recently changed neovim-nightly-overlay to wrap the built-in flake in neovim/contrib.

FWIW running NIX_PATH=nixpkgs=http://nixos.org/channels/nixpkgs-unstable/nixexprs.tar.xz nix-shell on my system works, so I'm not sure what is going on. Try nixUnstable?

I can't really reproduce this, for reference, you can try the following nixos-shell (available in nixpkgs), and it works:

{ pkgs, ... }: {
  boot.kernelPackages = pkgs.linuxPackages_latest;
  nixos-shell.mounts = {
    mountHome = false;
    mountNixProfile = false;
    cache = "none"; # default is "loose"
  };
  nixpkgs.overlays = [
    (import (builtins.fetchTarball {
      url = https://github.com/nix-community/neovim-nightly-overlay/archive/master.tar.gz;
    }))
  ];
  environment.systemPackages = with pkgs; [
    neovim-nightly #neovim also works here
  ];
  # programs.neovim.enable = true; # this also works for me
}

Can you send me a minimal nixos-shell (by modifying the above) that reproduces the problem? You can copy the nix-shell into this environment and try it.

573 commented

I think my nix-store had a problem, optimized it and now this works !
Thanks !

573 commented

Have to reopen.
On the problematic machine I repaired my nix-store, deleted garbage and finally upgraded nix to 2.3.10.
Still the offending command from OP runs into the error described there.

Will try the nixos-shell approach.

EDIT: The nix-shell I'm using is https://github.com/mjlbach/defaults.nvim/blob/122c64b31fefc92898b5dc97cec26e4d9944ec14/shell.nix

EDIT: Commented out anything except neovim-nightly in local copy of https://github.com/mjlbach/defaults.nvim/blob/122c64b31fefc92898b5dc97cec26e4d9944ec14/shell.nix

573 commented

With this nix expression

I can't really reproduce this, for reference, you can try the following nixos-shell (available in nixpkgs), and it works:

{ pkgs, ... }: {
  boot.kernelPackages = pkgs.linuxPackages_latest;
  nixos-shell.mounts = {
    mountHome = false;
    mountNixProfile = false;
    cache = "none"; # default is "loose"
  };
  nixpkgs.overlays = [
    (import (builtins.fetchTarball {
      url = https://github.com/nix-community/neovim-nightly-overlay/archive/master.tar.gz;
    }))
  ];
  environment.systemPackages = with pkgs; [
    neovim-nightly #neovim also works here
  ];
  # programs.neovim.enable = true; # this also works for me
}

Can you send me a minimal nixos-shell (by modifying the above) that reproduces the problem? You can copy the nix-shell into this environment and try it.

I get

[nixos-shell-2]$ NIX_PATH=nixpkgs=http://nixos.org/channels/nixpkgs-unstable/nixexprs.tar.xz make reproduce-issue
these derivations will be built:
/nix/store/xicv7gn13gnzaxp7k67akw0flyrc4inf-nixos-shell.drv
building '/nix/store/xicv7gn13gnzaxp7k67akw0flyrc4inf-nixos-shell.drv'...
unpacking sources
unpacking source archive /nix/store/ggm7fwh7m0zp4swhi4vzkvb1g108klnq-nixos-shell-2
source root is nixos-shell-2
patching sources
configuring
no configure script, doing nothing
building
build flags: SHELL=/nix/store/68c5b0h2w2ab57sbas1b4m073ik8hlm5-bash-4.4-p23/bin/bash
make: Nothing to be done for 'all'.
installing
install flags: SHELL=/nix/store/68c5b0h2w2ab57sbas1b4m073ik8hlm5-bash-4.4-p23/bin/bash install
install -D bin/nixos-shell /nix/store/hq0lchn93mk9ycly46gasgx49hz7ygmb-nixos-shell/bin/nixos-shell
install -D share/nixos-shell/nixos-shell.nix /nix/store/hq0lchn93mk9ycly46gasgx49hz7ygmb-nixos-shell/share/nixos-shell/nixos-shell.nix
post-installation fixup
shrinking RPATHs of ELF executables and libraries in /nix/store/hq0lchn93mk9ycly46gasgx49hz7ygmb-nixos-shell
strip is /nix/store/5xyjd2qiily84lcv2w2grmwsb8r1hqpr-binutils-2.35.1/bin/strip
stripping (with command strip and flags -S) in /nix/store/hq0lchn93mk9ycly46gasgx49hz7ygmb-nixos-shell/bin
patching script interpreter paths in /nix/store/hq0lchn93mk9ycly46gasgx49hz7ygmb-nixos-shell
/nix/store/hq0lchn93mk9ycly46gasgx49hz7ygmb-nixos-shell/bin/nixos-shell: interpreter directive changed from "#!/usr/bin/env bash" to "/nix/store/68c5b0h2w2ab57sbas1b4m073ik8hlm5-bash-4.4-p23/bin/bash"
checking for references to /tmp/nix-build-nixos-shell.drv-0/ in /nix/store/hq0lchn93mk9ycly46gasgx49hz7ygmb-nixos-shell...
/nix/store/hq0lchn93mk9ycly46gasgx49hz7ygmb-nixos-shell/bin/nixos-shell examples/defaults-vim.nix
error: infinite recursion encountered, at /nix/store/qkx75z9mbnpq8rm88mk56kgavamk3ar5-source/contrib/flake.nix:98:18
(use '--show-trace' to show detailed location information)
make: *** [Makefile:36: reproduce-issue] Error 1

Still not able to reproduce:

  1. nixos-shell with the following vm.nix
{ pkgs, ... }: {
  boot.kernelPackages = pkgs.linuxPackages_latest;
  nixos-shell.mounts = {
    mountHome = false;
    mountNixProfile = false;
    cache = "none"; # default is "loose"
  };
  virtualisation.diskSize = 5000;
  virtualisation.writableStoreUseTmpfs = false;
  environment.systemPackages = with pkgs; [
    git
  ];
}
  1. git clone https://github.com/mjlbach/defaults.nvim.git && cd defaults.nvim
  2. NIX_PATH=nixpkgs=http://nixos.org/channels/nixpkgs-unstable/nixexprs.tar.xz nix-shell
573 commented

Doing it like this works as well for me:

Still not able to reproduce:

1. `nixos-shell` with the following `vm.nix`
{ pkgs, ... }: {
  boot.kernelPackages = pkgs.linuxPackages_latest;
  nixos-shell.mounts = {
    mountHome = false;
    mountNixProfile = false;
    cache = "none"; # default is "loose"
  };
  virtualisation.diskSize = 5000;
  virtualisation.writableStoreUseTmpfs = false;
  environment.systemPackages = with pkgs; [
    git
  ];
}
1. `git clone https://github.com/mjlbach/defaults.nvim.git && cd defaults.nvim`

2. `NIX_PATH=nixpkgs=http://nixos.org/channels/nixpkgs-unstable/nixexprs.tar.xz nix-shell`

Still have to figure out how to use w/o nixos-shell.

Seems like it's something strange with your system configuration then, I would check your overlays/channels/etc and try running with the --pure flag

573 commented

You were right there was one offending overlay definition in my ~/.config/nixpkgs/overlays folder. Completely removed it temporarily and now all works.