Skip to content

Migrating from nixcats - "definition for option data is not of type null..." #505

@mettavi

Description

@mettavi

Hi, I have been using nixcats using the lazy template, but I would now like to remove lazy.nvim completely using the neovim wrapper from nix-wrapper-modules.

I am trying to implement this as a home-manager module. I am running home-manager as a module of nixos.

I started using the code from https://birdeehub.github.io/nix-wrapper-modules/md/getting-started.html#nixos-home-manager-and-friends along with code from the neovim template at https://github.com/BirdeeHub/nix-wrapper-modules/tree/main/templates/neovim

At first I had a lot of errors, so I decided to get it working with a minimal example first. Here is the code I managed to get working:

# nvim-wrap/default.nix
{
  config,
  inputs,
  lib,
  ...
}:
with lib;
let
  cfg = config.mettavi.shell.nvim-lib;
in
{
  # import the neovim wrapper module
  imports = [
    (inputs.wrappers.lib.getInstallModule {
      name = "neovim";
      value = inputs.wrappers.lib.wrapperModules.neovim;
    })
  ];

  options.mettavi.shell.nvim-lib = {
    enable = mkEnableOption "set up and configure the nvim wrapper module";
    cats = lib.mkOption {
      readOnly = true;
      type = lib.types.attrsOf lib.types.bool;
      default = builtins.mapAttrs (_: v: v.enable) config.specs;
    };
  config = mkIf cfg.enable {
    wrappers.neovim =
      { pkgs, ... }:
      {
        enable = true;
        env.NVIM_APPNAME = "nvim-wrap";
        # If you want to install multiple neovim derivations via home.packages or environment.systemPackages
        # in order to prevent path collisions:
        # set this to true:
        settings.dont_link = true;
        # and make sure these dont share values:
        binName = "nvw";
        # settings.aliases = [ ];

        settings.config_directory = ./config;

        specs.stylix = {
          data = with pkgs.vimPlugins; [
            mini-base16
            lazydev-nvim
          ];
          before = [ "INIT_MAIN" ];
          config = /* lua */ ''
            local info, pname, lazy = ...
            require("mini.base16").setup({ palette = info, })
          '';
        };
      };

    xdg.configFile = {
      "nvim-wrap".source = ./config;
    };
  }
 
  };
}

So, it works using specs.stylix, but anything else causes an error. When I add the following:

        specs.lua = {
          after = [ "lazy" ];
          lazy = true;
          data = with pkgs.vimPlugins; [
            lazydev-nvim
          ];
          extraPackages = with pkgs; [
            lua-language-server
            stylua
          ];
        };

I get the following error:

       error: A definition for option `home-manager.users.timotheos.wrappers.neovim.specs.lua.data' is not of type `null or str|path|drv or list of spec with main field: `data` of (null or str|path|drv)'. Definition values:
       - In `/nix/store/d5ndqy86a9is1wjyickly0xr5v94h2r7-source/home/shared/modules/shell/nvim-wrap':
           {
             after = [
               "lazy"
             ];
             data = [
           ...

I get the same error if I add specs.bash, specs.nix, or anything else.

Now, I am sure I am making a silly mistake here, can anyone help me solve this problem?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions