amitds1997 / remote-nvim.nvim

Remote development in Neovim 🔥
MIT License
613 stars 13 forks source link

Nix breaks remote installation scripts #150

Open damccull opened 3 months ago

damccull commented 3 months ago

Describe the bug

When trying to launch a devcontainer using devpod on local docker provider under NixOS, everything works great until it tries to run:

Command: chmod +x /home/vscode/.remote-nvim/scripts/neovim_download.sh && chmod +x /home/vscode/.remote-nvim/scripts/neovim_utils.sh && chmod +x /home/vscode/.remote-nvim/scripts/neovim_install.sh && /home/vscode/.remote-nvim/scripts/neovim_install.sh -v v0.10.0 -d /home/vscode/.remote-nvim -m binary -a x86_64

At this point it fails with

bash: line 1: /home/vscode/.remote-nvim/scripts/neovim_install.sh: cannot execute: required file not found

From what I can guess, since my devcontainer doesn't have nix or NixOS installed, but is an unbuntu container, the script is getting incorrectly mangled or something. The first line of the script comes out to be:

#!/nix/store/agkxax48k35wdmkhmmija2i2sxg8i7ny-bash-5.2p26/bin/bash

To reproduce

Steps to reproduce the behavior:

  1. Install plugin on nixos using flake inputs using something like this repo: https://github.com/damccull/kickstart-nix.nvim/ a. The plugin is imported from github directly in flake.nix, built into a nix vim plugin in neovim-overlay.nix, and instantiated under nvim/plugin/remote-nvim.lua
  2. Try to connect to a dev container.
  3. Watch it fail.

Expected behavior

Should install nvim on remote and connect to it.

Screenshots

System info

Additional context

I think maybe the nix vim plugin maker might be mangling the script, expecting to make it work on a nix install rather than anything else.

damccull commented 3 months ago

I believe this could be fixed by not pulling the scripts from the local computer, but from github directly. I'm not currently aware of another way to fix it. The ability for nix to build a plugin with its vimUtils apparently mangles all shell scripts to point at nix store derivations directly.

amitds1997 commented 2 months ago

Hey @damccull could you try the fix/install-scripts-for-nix-system and let me know if it works now. The plugin now runs explicit bash command to run the script so as long as the remote system has the interpreter available on PATH, it should work (ignoring the shebang).