nvim-ghost.nvim icon indicating copy to clipboard operation
nvim-ghost.nvim copied to clipboard

Install script breaks on nix-based installations

Open Soliprem opened this issue 1 year ago • 3 comments

in a nix environment, the install script will try to download the binary into the nix store, which is a readonly file system.

Downloading https://github.com/subnut/nvim-ghost.nvim/releases/download/v0.5.4/
im-ghost-linux.tar.gz
#=#=#                                                                          
##O#- #                                                                        
Warning: Failed to open the file nvim-ghost-linux.tar.gz: Read-only file system
curl: (23) client returned ERROR on write of 16375 bytes


[Process exited 23]

Soliprem avatar Aug 06 '24 09:08 Soliprem

I haven't tried the fresh install, but with

{pkgs, ...}: let
  ghosttext-dependencies = pkgs.python313.withPackages (ps:
    with ps; [
      pynvim
      requests
      (buildPythonPackage {
        pname = "simple-websocket-server";
        version = "0.4.4";
        format = "setuptools";
        src = pkgs.fetchFromGitHub {
          owner = "pikhovkin";
          repo = "simple-websocket-server";
          rev = "47a7dce556d22db483ec9c3db72b6c87736d8063";
          sha256 = "sha256-FlrYdT2wH6dj/72ELhfzwvfuoinhMy4/wEMEiQQp/ro=";
        };

        meta = with lib; {
          description = "Python based websocket server that is simple and easy to use";
          homepage = "https://github.com/pikhovkin/simple-websocket-server";
          license = licenses.mit;
          platforms = platforms.all;
        };
      })
    ]);
in {
  home-manager.users.${user}.home.sessionVariables = {
    NVIM_GHOST_PYTHON_EXECUTABLE = "${ghosttext-dependencies}/bin/python";
  };
}
vim.g.nvim_ghost_use_script = 1
vim.g.nvim_ghost_python_executable = vim.env.NVIM_GHOST_PYTHON_EXECUTABLE

it does work. I assume with nvim_ghost_use_script it won't start the download.

Andrew15-5 avatar Feb 19 '25 20:02 Andrew15-5

I assume with nvim_ghost_use_script it won't start the download.

That is correct.
Thanks for the workaround, @Andrew15-5


Disclaimer: I have zero experience when it comes to nix, so I don't know the "proper" way to fix this problem.
So, I'm gonna leave this issue open for now.

subnut avatar Feb 19 '25 21:02 subnut

I haven't touched Neovim stuff for now, so I just copied over my config from previous OS to NixOS. It feels decent, but not ideal. It is the first thing that came to mind since there is only one Python file and there is already a variable that can be set with the absolute path to the Python binary, which in nixpkgs can contain Python dependencies. I'm very happy that it worked. Now I can continue using this plugin. No idea what is a better way in this situation.

But the issue on NixOS is that the downloaded binary is dynamically linked, so it doesn't work by default, and patching it might not work either. So I used the alternative, which is running the script.

Andrew15-5 avatar Feb 19 '25 21:02 Andrew15-5