Skip to content

two nvim-cmp sources for nixpkgs

License

Notifications You must be signed in to change notification settings

gravndal/cmp-nixpkgs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

60 Commits
 
 
 
 
 
 
 
 

Repository files navigation

cmp-nixpkgs

Consider using https://github.com/oxalica/nil or https://github.com/nix-community/nixd instead.

Contains two sources:

  • nixpkgs for pkgs, lib, and config.
  • nixos for NixOS modules.

The sources assume that there are two flakes named self and nixpkgs in the flake registry, and that these flakes in turn both output legacyPackages.

It's recommended to pin nixpkgs in your flake registry to avoid potentially slow lookups of suggestions for prev and super. See this post on the discourse for a way to do so.

By default, completion for final/prev and self/super is only enabled in buffers whose full filename starts with resolve('/etc/nixos') .. '/overlay'. This is configurable through g:cmp_nixpkgs_overlay.1

NixOS module completion is only enabled for files under resolve('/etc/nixos/'). The suggestions are attribute paths found under config2, as a consequence, these suggestions will match your currently running system so long as self is properly pinned.3

If manix is in PATH, then it will be used to resolve documentation for lib and NixOS modules.

Depends on https://github.com/nvim-treesitter/nvim-treesitter.

Footnotes

  1. To take effect, this must be set before the nixpkgs source is initialised.

  2. More accurately self#nixosConfigurations.$hostname.config.

  3. There is some overlap between the nixos source and the config completion from nixpkgs, however there is a significant difference in that the two sources don't use the same tree-sitter context.

About

two nvim-cmp sources for nixpkgs

Topics

Resources

License

Stars

Watchers

Forks

Languages