Skip to content

pete3n/nix-prefetch.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nix-prefetch.nvim

This is a story about Pete

Pete loves Nix ❤️ Icon

Pete likes to write Nix using Neovim Icon

This is what happens to Pete:

  • Pete commits changes his project repo.
  • Pete wants to build and test his changes but must update the git revision and hash for Nix first.
  • Pete doesn't use Nix well, so he just erases the old hash, and rebuilds, then copies the hash-mismatch error message and pastes it back into his config, then rebuilds again.
  • Pete does this alot Icon because he is bad at developing software.

Don't be like Pete, use nix-prefetch.nvim!

Current Support

nix-prefetch.nvim is currently limited to fetchFromGitHub attribute sets using a rev and hash value (See Future Development for planned features). As an example of a supported format, this is the code block to include nix-prefetch.nvim in your Nixvim config:

  extraPlugins = [
    (pkgs.vimUtils.buildVimPlugin {
      name = "nix-prefetch.nvim";
      src = pkgs.fetchFromGitHub {
        owner = "pete3n";
        repo = "nix-prefetch.nvim";
        rev = "44496fb3e706c795e87d475d674708919a01cbea";
        hash = "sha256-tSDIGbTD+5fm1Qo3922DGJ1YIRNAUJF2btWf4kWbCoM=";
      };
    })
  ];

This will register the NGUpdateRepo command which you can keybind. If you call NGUpdateRepo with the cursor in a fetchFromGitHub attribute set, then it will check for the most recent revision, and if it is different from the current, updates the revision and the corresponding hash.

Dependencies

nvim-treesitter must be installed. jq, and nix-prefetch-git must be executable and available in your path. To confirm dependencies are availabe, nix-prefetch includes a health check function that you can run from the nvim commandline with:

    :checkhealth nix-prefetch

Future Development

  • fetchFromGitHub: update rev and hash
    • fetchFromGithub: preserve rev, update hash
    • sha256 attribute support
    • version tag interpretation/support
  • fetchFromGitLab support
  • fetchurl support
  • fetchzip support

About

Neovim automated hash update plugin for Nix

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages