For some reason, I fail to pass through inputs
of my flake to nixvim
to build a custom plugin from a flake input.
My flake has
outputs = {...}@inputs: { ... }
and uses inputs.nixvim.legacyPackages.x86_64-linux.makeNixvimWithModule
with the following:
nixvimModule = {
pkgs = inputs.unstable.legacyPackages.x86_64-linux // inputs.self.packages."x86_64-linux";
module = import ./neovim;
};
where ./neovim/default
is a _: { imports = [ ... ]; }
I also use home-manager with
home-manager.users.m = { config, ... }: {
imports = [ inputs.nixvim.homeManagerModules.nixvim ];
programs.nixvim = {
enable = true;
imports = [ ./neovim ];
nixpkgs.pkgs = inputs.unstable.legacyPackages.x86_64-linux;
};
# more...
}
I use both the makeNixvimWithModule
and the HM configuration so that I can use nix build .#nvim
to build a new nixvim without rebuilding the whole system.
In my ./neovim/plugins/telescope.nix
I package a flake input as neovim plugin:
{ inputs, pkgs, ... }:
{
extraPlugins = let
telescope-git-author-picker = pkgs.vimUtils.buildVimPlugin {
name = "telescope-git-author-picker";
src = inputs.telescope-git-author-picker;
dependencies = [];
};
in [ telescope-git-author-picker ];
extraConfigLua = ''
require('telescope').load_extension("git_author")
'';
but the above fails because inputs
is not known:
$ nixos-rebuild --flake .#hoshi build --show-trace [...]
1792| */
1793| unique = foldl' (acc: e: if elem e acc then acc else acc ++ [ e ]) [];
| ^
1794|
… while evaluating derivation 'vimplugin-telescope-git-author-picker'
whose name attribute is located at /nix/store/c05d1sqfhkl93p3j5ykic68mgg1gsrvb-source/pkgs/stdenv/generic/make-derivation.nix:336:7
… while evaluating attribute 'src' of derivation 'vimplugin-telescope-git-author-picker'
at /nix/store/6zsx436sipjxa9xvwz902n7b345in51c-source/nixos/neovim/plugins/telescope.nix:7:7:
6| name = "telescope-git-author-picker";
7| src = inputs.telescope-git-author-picker;
| ^
8| dependencies = [];
… while calling anonymous lambda
at /nix/store/8f039qdj69z78ls6rf9xli6rc638g36x-source/lib/modules.nix:506:44:
505| context = name: ''while evaluating the module argument `${name}' in "${key}":'';
506| extraArgs = builtins.mapAttrs (name: _:
| ^
507| builtins.addErrorContext (context name)
… while evaluating the module argument `inputs' in "/nix/store/6zsx436sipjxa9xvwz902n7b345in51c-source/nixos/neovim/plugins/telescope.nix":
error: attribute 'inputs' missing
at /nix/store/8f039qdj69z78ls6rf9xli6rc638g36x-source/lib/modules.nix:508:28:
507| builtins.addErrorContext (context name)
508| (args.${name} or config._module.args.${name})
| ^
509| ) (lib.functionArgs f);
And I am a bit at loss here because I don’t understand where the issue is. I played around with extraSpecialArgs = { inherit inputs; }
at different places as well as with _module.args = { inherit inputs; };
but nothing helped.
Maybe someone here has an idea.