Add nvim package output on the flake

This commit is contained in:
2024-12-24 12:02:58 +01:00
parent ea384380cf
commit 2664c8fe5d
3 changed files with 112 additions and 0 deletions
+8
View File
@@ -60,6 +60,7 @@
};
mkSystem = import ./lib/mksystem.nix (inputs // {inherit overlays inputs;});
eachSystem = nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed;
in {
nixosConfigurations.fuhen = mkSystem "fuhen" {
env = "river";
@@ -100,5 +101,12 @@
./modules/gui/ghostty.nix
];
};
packages = eachSystem (system: let
pkgs = nixpkgs.legacyPackages.${system};
in rec {
default = nvim;
nvim = import ./nvim (inputs // { inherit pkgs; });
});
};
}
+52
View File
@@ -0,0 +1,52 @@
{
pkgs,
neovim-nightly,
...
}: let
mkNvim = pkgs.callPackage ./mknvim.nix {inherit pkgs;};
in
mkNvim {
withNodeJs = false;
withRuby = false;
withPython3 = false;
package = neovim-nightly.packages.${pkgs.system}.default;
config = ./.;
plugins = with pkgs.vimPlugins; [
{
plugin = lz-n;
optional = false;
}
# TODO: make grammars optional
nvim-treesitter.withAllGrammars
catppuccin-nvim
];
lsp = with pkgs; [
# see for helpers https://github.com/dundalek/lazy-lsp.nvim/blob/master/lua/lazy-lsp/servers.lua
haskell-language-server
rust-analyzer
clang-tools
omnisharp-roslyn
pyright
typescript-language-server
nil
gopls
vscode-langservers-extracted # html, jsonls
yaml-language-server
marksman
ltex-ls
texlab
helm-ls
zls
lua-language-server
];
extraPackages = with pkgs; [
# Give access to gdbus for color-scheme detection (vim-lumen).
glib
];
}
+52
View File
@@ -0,0 +1,52 @@
{
pkgs,
lib,
stdenv,
...
}: {
package ? pkgs.neovim,
config,
plugins ? [],
extraPackages ? [],
lsp ? [],
extraLuaPackages ? p: [],
extraPython3Packages ? p: [],
withPython3 ? false,
withPerl ? false,
withRuby ? false,
withNodeJs ? false,
withSqlite ? false,
}: let
# Stolen from pkgs.neovimUtils.normalizePlugins but this changes defaultPlugin.optional to true.
normalizePlugins = plugins: let
defaultPlugin = {
plugin = null;
config = null;
optional = true;
};
in
map (x:
defaultPlugin
// (
if (x ? plugin)
then x
else {plugin = x;}
))
plugins;
externalPackages = extraPackages ++ lsp;
in
pkgs.wrapNeovimUnstable package {
# maybe use true here?
autoconfigure = false;
autowrapRuntimeDeps = false;
plugins = normalizePlugins plugins;
wrapRc = false;
wrapperArgs = builtins.concatStringsSep " " [
(lib.optionals (externalPackages != []) ''--prefix PATH : "${lib.makeBinPath externalPackages}"'')
];
inherit withPython3 withNodeJs withPerl withRuby extraPython3Packages extraLuaPackages;
}