nixvim icon indicating copy to clipboard operation
nixvim copied to clipboard

plugins/ccc: Add more settings

Open janurskremer opened this issue 3 months ago • 5 comments

I tried to add more settings to the plugin with suggestions by @GaetanLepage.

checks failed with this error:

error: builder for '/nix/store/jm8y8klh0zvjbn4fkkspj840mkda5kv7-plugins-utils-ccc-example.drv' failed with exit code 1;
       last 8 log lines:
       > Running phase: patchPhase
       > Running phase: configurePhase
       > no configure script, doing nothing
       > Running phase: buildPhase
       > ERROR: Error detected while processing /nix/store/07i48i1sqr60dir3prki4p2cax0aai0s-init.lua:
       > E5113: Error while calling lua chunk: /nix/store/07i48i1sqr60dir3prki4p2cax0aai0s-init.lua:30: attempt to index global 'ccc' (a nil value)
       > stack traceback:
       >  /nix/store/07i48i1sqr60dir3prki4p2cax0aai0s-init.lua:30: in main chunk
       For full logs, run 'nix log /nix/store/jm8y8klh0zvjbn4fkkspj840mkda5kv7-plugins-utils-ccc-example.drv'.
error: 1 dependencies of derivation '/nix/store/9iayb3kxg7lm0vs05agq9pn4b6zzb4pi-nixvim-tests.drv' failed to build
error: build of '/nix/store/9aa86a39l8vz3h974f2dcsnyd6jfwfjv-darwin-system-24.05.20240329.d8fe5e6+darwin4.36524ad.drv', '/nix/store/9iayb3kxg7lm0vs05agq9pn4b6zzb4pi-nixvim-tests.drv', '/nix/store/c2vg4dkn92yzpc8y5kfyszwri1fy7lf4-special-arg-test.drv', '/nix/store/gl8kcfjz2yjjvbfrfngk0817fkh7rzv6-enable-except-in-tests.drv', '/nix/store/gnm94gsiswc13gvi0bjxfkai88zzkdk8-no-flakes.drv', '/nix/store/jsmf0hf1a7zmbd53g7h89c1lh6bsbq6w-extend-test.drv', '/nix/store/ms8j2g1dnc7x0f1vr22by7fd3s2qql0w-home-manager-generation.drv', '/nix/store/sgbs5pn0c1vr5m9z18rygh72ld468rq9-nixvim-check.drv' failed

Please help me figure out what I'm missing.

janurskremer avatar Apr 03 '24 17:04 janurskremer

checks failed with this error:

This error occurs because ccc has not been declared previously in the lua config. What you can do is seting callSetup = false;. This will disable the calling of the setup function by helpers.mkNeovimPlugin. Then, you can do the following:

callSetup = false;
extraConfig = cfg: {
  extraConfigLua = ''
    ccc = require('ccc')
    ccc.setup(${helpers.toLuaObject cfg.settings})
  '';
};

GaetanLepage avatar Apr 04 '24 11:04 GaetanLepage

So just put this at the end of ccc.nix? Why didn't this error occur last time?

janurskremer avatar Apr 04 '24 12:04 janurskremer

So just put this at the end of ccc.nix?

Yeah

Why didn't this error occur last time?

Last time you weren't referencing ccc as a lua variable.

When you use (e.g.) ccc.input.rgb you're assuming the lua variable ccc exists and is in-scope.

Gaétan's suggestion is to ensure ccc = require('ccc') before calling setup.

Without disabling callSetup, it is called automatically without first defining ccc.

If we had something like an extraConfigLuaPre then the fix could be simpler.

MattSturgeon avatar Apr 04 '24 18:04 MattSturgeon

Why didn't this error occur last time?

When you use (e.g.) ccc.input.rgb you're assuming the lua variable ccc exists and is in-scope.

Gaétan's suggestion is to ensure ccc = require('ccc') before calling setup.

Without disabling callSetup, it is called automatically without first defining ccc.

If we had something like an extraConfigLuaPre then the fix could be simpler.

We do have that I think?

traxys avatar Apr 04 '24 19:04 traxys

We do have [extraConfigLuaPre] I think

We have a module option, but I can't see a parameter in the mkPlugin functions.

https://github.com/nix-community/nixvim/blob/2c99cefa913c8afb8fa08e53608c6f8bd5a2e5c4/lib/neovim-plugin.nix#L53

Not saying we need one though, just that this specific scenario would be simpler with it.

MattSturgeon avatar Apr 04 '24 20:04 MattSturgeon