This repository has been archived on 2024-05-17. You can view files and clone it, but cannot push or open issues or pull requests.
neovim/flake.nix

84 lines
2.0 KiB
Nix

{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
utils.url = "github:numtide/flake-utils";
# Plenary (required by crates-nvim)
plenary-nvim = {
url = "github:nvim-lua/plenary.nvim";
flake = false;
};
# lsp
# https://github.com/neovim/nvim-lspconfig
nvim-lspconfig = {
url = "github:neovim/nvim-lspconfig?rev=d4eb971db353ccf78cefb3be1b05483b69ec1e69";
flake = false;
};
# https://github.com/glepnir/lspsaga.nvim
lspsaga-nvim = {
url = "github:glepnir/lspsaga.nvim?rev=381900d932db058aa3236ba66cc9f45747c0df71";
flake = false;
};
};
outputs = inputs @ { self, nixpkgs, utils, ... }:
let
inputPlugins = [
"plenary-nvim"
# lsp
"nvim-lspconfig"
"lspsaga-nvim"
];
mkNvimPlugins = { lib, vimUtils, vimPlugins, ... }:
let
inherit (builtins) getAttr;
inherit (lib) listToAttrs nameValuePair;
buildPlugin = name: vimUtils.buildVimPluginFrom2Nix {
name = name;
src = getAttr name inputs;
};
buildPluginValuePair = n: nameValuePair n (buildPlugin n);
customPlugins = listToAttrs (map buildPluginValuePair inputPlugins);
in
{ vimPlugins = vimPlugins // customPlugins; };
in
{
overlays = {
default = final: prev: {
myneovim = prev.callPackage ./. (mkNvimPlugins prev);
};
};
} //
utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
neovim = pkgs.callPackage ./. (mkNvimPlugins pkgs);
in
{
apps.default = {
type = "app";
program = "${neovim}/bin/nvim";
};
packages.default = neovim;
devShells.default = pkgs.mkShell {
packages = [
(neovim.override {
enableDevIcons = true;
enableTabby = true;
})
pkgs.stylua # lua formatter
];
};
});
}