nixvim
nixvim copied to clipboard
plugins/ccc: Add more settings
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.
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})
'';
};
So just put this at the end of ccc.nix
? Why didn't this error occur last time?
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.
Why didn't this error occur last time?
When you use (e.g.)
ccc.input.rgb
you're assuming the lua variableccc
exists and is in-scope.Gaétan's suggestion is to ensure
ccc = require('ccc')
before callingsetup
.Without disabling
callSetup
, it is called automatically without first definingccc
.If we had something like an
extraConfigLuaPre
then the fix could be simpler.
We do have that I think?
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.