cutomRC for vim error message

Hello all

I’m trying to set some parameters to the vimrc file so far I’ve got this:

  # List packages installed in system profile. To search, run:
  # $ nix search wget
  environment.systemPackages = with pkgs; [
    wget
    vimHugeX
    smartmontools
    x11vnc
    vim_configurable.customize {
      vimrcConfig.customRC = ''
        set number
        set mouse=v
      '';
    }   
  ];  

The corresponding manual: https://nixos.org/manual/nixpkgs/stable/#custom-configuration

and I get the following error message:

error: A definition for option `environment.systemPackages.[definition 1-entry 5]' is not of type `package'. Definition values:
       - In `/etc/nixos/configuration.nix': <function, args: {executableName?, gvimExecutableName?, gvimrcFile?, name?, standalone?, vimExecutableName?, vimrcConfig?, vimrcFile?, wrapGui?, wrapManual?}>
(use '--show-trace' to show detailed location information)

what could be the problem?

also I found this post: https://discourse.nixos.org/t/trouble-with-vim-plugins-for-vim-customizable/1242

could this also play a role?

In Nix list elements are separated by space, just like function calls, which makes much confusion, as list construction takes precedence. In your case, last two elements of the environment.systemPackages are vim_configurable.customize and { vimrcConfig.customRC = ...}. The module system complains at the former, because it’s a function, and not a package.
To fix the issue, just put this function call in braces.

1 Like

gotcha! Thank you you very I do!

# List packages installed in system profile. To search, run:
  # $ nix search wget
  environment.systemPackages = with pkgs; [
    wget
    vimHugeX
    #neovim
    smartmontools
    x11vnc

    # Vim config
    (vim_configurable.customize {
    name = "vim-with-plugins";
    vimrcConfig.customRC = ''
        set number
        set relativenumber
        set mouse=v
      '';
    })
 ];

now it works …