Coder Social home page Coder Social logo

Comments (13)

traxys avatar traxys commented on September 27, 2024 1

It may be that the master image.nvim has changes from the nixpkgs one. The other posibility is that image.nvim has nixpkgs overrides. I would consider doing pkgs.vimPlugins.image-nvim.overiddeAttrs (_: { src = ipnuts.image-nvim; }), that would handle the second case.

from nixvim.

traxys avatar traxys commented on September 27, 2024 1

Exatcly!

from nixvim.

MartinEekGerhardsen avatar MartinEekGerhardsen commented on September 27, 2024

As an aside, which could actually be a nixvim bug, while trying to debug this issue I forked image.nvim and added a non-flake input to this test config. Then I change config/default.nix like this:

{
pkgs,
inputs,
...
}:
{
  # Import all your configuration modules here
  imports = [
    ./bufferline.nix
  ];

  plugins.image = {
    enable = true;
    package = let
      image-nvim = pkgs.vimUtils.buildVimPlugin {
        name = "image.nvim";
        src = inputs.image-nvim;
      };
    in image-nvim;
  };
}

Now when I run nix run .#, I get this error:

Error detected while processing /nix/store/7n4hrzs3kv68r5mr22xbyxb695hb4dpy-init.lua:
image.nvim: magick rock not found, please install it and restart your editor

If I comment out the overwritten package (such that I get the nixpkgs version), I get no error. As far as I understand the nixvim implementation of plugins.image, this should be available either way?

from nixvim.

MartinEekGerhardsen avatar MartinEekGerhardsen commented on September 27, 2024

Thanks, adding that override solved that issue! I expect using an autocmd on UIEnter around the functions which actually requires the UI to be available should solve this. I'll open an issue on the image.nvim plugin repo.

from nixvim.

MartinEekGerhardsen avatar MartinEekGerhardsen commented on September 27, 2024

There seems to be several places where this plugin assumes we are not in a headless mode, so I think there might not be a simple way to fix this. Is there a way to just remove this plugin when I run nix flake check ., without removing it for my actual config?

from nixvim.

traxys avatar traxys commented on September 27, 2024

There should be a way to disable running the tests in nixvim

from nixvim.

traxys avatar traxys commented on September 27, 2024

We should have disabled it:

  empty = {
    # At runtime, the plugin tries to get the size of the terminal which doesn't exist in the
    # headless environment.
    tests.dontRun = true;

    plugins.image.enable = true;
  };

from nixvim.

traxys avatar traxys commented on September 27, 2024

Ah I see your issue, you are trying to use it for your own config. That's an issue I had not yet considered!

from nixvim.

traxys avatar traxys commented on September 27, 2024

You may want to disable image.nvim while running in the test derivation. I'll think of a way to do it automatically though.

from nixvim.

MartinEekGerhardsen avatar MartinEekGerhardsen commented on September 27, 2024

Yeah, is there a way to override the config set from the result of makeNixvimWithModule?

from nixvim.

traxys avatar traxys commented on September 27, 2024

With #1095 there is now a way to handle this! I updated the template at https://github.com/nix-community/nixvim/blob/main/templates/simple/flake.nix if you want an example on how to make this work

from nixvim.

MartinEekGerhardsen avatar MartinEekGerhardsen commented on September 27, 2024

Thank you for the quick work! I tried to update my flake based on this, if I update my flake and do these changes, should it work?

diff --git a/flake.nix b/flake.nix
index 76479c7..727074f 100644
--- a/flake.nix
+++ b/flake.nix
@@ -50,7 +50,8 @@
       }: let
         nixvimLib = nixvim.lib.${system};
         nixvim' = nixvim.legacyPackages.${system};
-        nvim = nixvim'.makeNixvimWithModule {
+
+        nixvimModule = {
           inherit pkgs;
           module = config;
           # You can use `extraSpecialArgs` to pass additional arguments to your module files
@@ -59,6 +60,8 @@
             inherit inputs;
           };
         };
+
+        nvim = nixvim'.makeNixvimWithModule nixvimModule;
       in {
         _module.args.pkgs = import nixpkgs {
           inherit system;
@@ -72,10 +75,7 @@

         checks = {
           # Run `nix flake check .` to verify that your config is not broken
-          default = nixvimLib.check.mkTestDerivationFromNvim {
-            inherit nvim;
-            name = "A nixvim configuration";
-          };
+          default = nixvimLib.check.mkTestDerivationFromNixvimModule nixvimModule;
         };

         packages = {

I tried this and get the same error. Or should I use helpers.enableExceptInTests to enable the image plugin as well?

from nixvim.

MartinEekGerhardsen avatar MartinEekGerhardsen commented on September 27, 2024

Works perfectly, thank you!

from nixvim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.