BirdeeHub / nixCats-nvim

A nix-based nvim package manager that supports a normal config directory ... that can easily output mulitiple configured packages! (with example config(s) and in-editor help)
https://nixcats.org/nixCats_installation.html
MIT License
283 stars 11 forks source link

error: function 'wrapper' called without required argument 'luaEnv' #65

Open rickmoonex opened 2 days ago

rickmoonex commented 2 days ago

Trying to get my standalone nixCats flake working but I keep running into this error:

error: function 'wrapper' called without required argument 'luaEnv'
       at /nix/store/zvh4vfgfb1s4i1nkbivn1vzg9pn3dvp2-source/nix/builder/wrapper.nix:18:13:
           17|
           18|   wrapper = {
             |             ^
           19|     # lets you append stuff to the derivation name so that you can search for it in the store easier

My flake.nix looks like this:

# Copyright (c) 2023 BirdeeHub
# Licensed under the MIT license

# This is an empty nixCats config.
# you may import this template directly into your nvim folder
# and then add plugins to categories here,
# and call the plugins with their default functions
# within your lua, rather than through the nvim package manager's method.
# Use the help, and the example repository https://github.com/BirdeeHub/nixCats-nvim

# It allows for easy adoption of nix,
# while still providing all the extra nix features immediately.
# Configure in lua, check for a few categories, set a few settings,
# output packages with combinations of those categories and settings.

# All the same options you make here will be automatically exported in a form available
# in home manager and in nixosModules, as well as from other flakes.
# each section is tagged with its relevant help section.

{
  description = "A Lua-natic's neovim flake, with extra cats! nixCats!";

  inputs = {
    nixCats.url = "github:BirdeeHub/nixCats-nvim";
    nixCats.inputs.nixpkgs.follows = "nixpkgs";
  };

  outputs = { self, nixpkgs, nixCats, ... }@inputs: let
    inherit (nixCats) utils;
    luaPath = "${./.}";
    forEachSystem = utils.eachSystem nixpkgs.lib.platforms.all;
    extra_pkg_config = {
      # allowUnfree = true;
    };
    inherit (forEachSystem (system: let
      dependencyOverlays = [
        (utils.standardPluginOverlay inputs)
      ];
    in { inherit dependencyOverlays; })) dependencyOverlays;

    categoryDefinitions = { pkgs, settings, categories, name, ... }@packageDef: {
      propagatedBuildInputs = {
        generalBuildInputs = with pkgs; [
        ];
      };

      lspsAndRuntimeDeps = {
        general = with pkgs; [
          stdenv.cc.cc
          gopls
          luajitPackages.lua-lsp
          yaml-language-server
          clang-tools
          lua-language-server
          rust-analyzer
          nodePackages.typescript-language-server
          nodePackages.vscode-langservers-extracted # for html, cssls, etc.
          nodePackages.svelte-language-server
          nodePackages.graphql-language-service-cli
          nodePackages."@tailwindcss/language-server"
          pyright
          nodePackages.prettier
          stylua
          isort
          black
          pylint
          nodePackages.eslint
          emmet-ls
          nodePackages."@prisma/language-server"

        ];
      };

      startupPlugins = {
        customPlugins = with pkgs.nixCatsBuilds; [ ];
        gitPlugins = with pkgs.neovimPlugins; [ ];
        general = with pkgs.vimPlugins; [ ];
      };

      optionalPlugins = {
        customPlugins = with pkgs.nixCatsBuilds; [ ];
        gitPlugins = with pkgs.neovimPlugins; [ ];
        general = with pkgs.vimPlugins; [ ];
      };

      sharedLibraries = {
        general = with pkgs; [
        ];
      };

      environmentVariables = {
        test = {
          CATTESTVAR = "It worked!";
        };
      };

      extraWrapperArgs = {
        test = [
          '' --set CATTESTVAR2 "It worked again!"''
        ];
      };

      extraPython3Packages = {
        test = (py:[
          py.pylint
          py.pyls-isort
          py.python-lsp-black
        ]);
      };
    };

    packageDefinitions = {
      nixCats = {pkgs , ... }: {
        settings = {
          wrapRc = true;
          aliases = [ "vim" ];
        };
        categories = {
          general = true;
          gitPlugins = true;
          customPlugins = true;
          generalBuildInputs = true;
          test = true;
          example = {
            youCan = "add more than just booleans";
            toThisSet = [
              "and the contents of this categories set"
              "will be accessible to your lua with"
              "nixCats('path.to.value')"
              "see :help nixCats"
            ];
          };
        };
      };
    };
    defaultPackageName = "nixCats";
  in
  forEachSystem (system: let
    inherit (utils) baseBuilder;
    customPackager = baseBuilder luaPath {
      inherit nixpkgs system dependencyOverlays extra_pkg_config;
    } categoryDefinitions;
    nixCatsBuilder = customPackager packageDefinitions;
    pkgs = import nixpkgs { inherit system; };
  in
  {
    packages = utils.mkPackages nixCatsBuilder packageDefinitions defaultPackageName;

    devShells = {
      default = pkgs.mkShell {
        name = defaultPackageName;
        packages = [ (nixCatsBuilder defaultPackageName) ];
        inputsFrom = [ ];
        shellHook = '''';
      };
    };

    inherit customPackager;
  }) // {
    overlays = utils.makeOverlays luaPath {
      inherit nixpkgs dependencyOverlays extra_pkg_config;
    } categoryDefinitions packageDefinitions defaultPackageName;

    nixosModules.default = utils.mkNixosModules {
      inherit defaultPackageName dependencyOverlays luaPath
        categoryDefinitions packageDefinitions nixpkgs;
    };
    homeModule = utils.mkHomeModules {
      inherit defaultPackageName dependencyOverlays luaPath
        categoryDefinitions packageDefinitions nixpkgs;
    };
    inherit utils categoryDefinitions packageDefinitions dependencyOverlays;
    inherit (utils) templates baseBuilder;
    keepLuaBuilder = utils.baseBuilder luaPath;
  };
}
BirdeeHub commented 2 days ago

I am able to build it fine. But I dont have your lockfile. And your flake doesnt have a nixpkgs input either.

2 possibilities.

  1. Your flake does not have a nixpkgs input. If you have replaced your neovim-unwrapped in your system nixpkgs registry entry, with like, a git patch (I dont think just an overlay would do it unless you install it via the module), and that new neovim-unwrapped doesnt output a lua attribute for the wrapper to use, it might not work.

To fix number 1, add a nixpkgs input to your flake.

  1. Your nixCats is quite out of date. Update the nixCats input.

Also, you can remove the follows statement, there is no nixpkgs input to follow. NixCats flake has no inputs.

But yeah, make sure everything is up to date.

BirdeeHub commented 2 days ago

Actually, I can confirm that your nixCats is VERY out of date. Like, months.

You dont have any breaking changes to worry about though. Just update it. And remove the follows because its not needed.

       at /nix/store/zvh4vfgfb1s4i1nkbivn1vzg9pn3dvp2-source/nix/builder/wrapper.nix:18:13:
  17|
           18|   wrapper = {
             |             ^
           19|     # lets you append stuff to the derivation name so that you can search for it in the store

This line hasnt existed for a while. That file isnt even in that location anymore.

BirdeeHub commented 2 days ago

If it still happens after updating nixCats and adding a nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; to your inputs please let me know!! For what its worth, without the lockfile I was able to build it with no changes.

BirdeeHub commented 2 days ago

But yeah I dont know what version you are on, but I know your config builds on the latest version of nixCats and nixpkgs-unstable. So there are no breaking changes you should have to deal with when doing so.

There have been several new features added since you last checked in though! When you get the chance you should check out the example config again and see what new features you have available!

BirdeeHub commented 2 days ago

What OS are you on also? Although that shouldnt really matter. Updating nixCats + maybe adding the nixpkgs input so that its not grabbing a random one from your system should clear things up.