Files
nvim/flake.nix
2026-04-02 10:49:14 +01:00

98 lines
2.1 KiB
Nix

{
description = "Neovim with LSP dev shell";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
};
outputs =
{ self, nixpkgs }:
let
system = "x86_64-linux"; # change if needed
pkgs = import nixpkgs { inherit system; };
pkgList = with pkgs; [
# LSPs
lua-language-server
vscode-langservers-extracted
emmet-ls
rust-analyzer
prettier
black
nixfmt
rustfmt
nil
python313Packages.python-lsp-server
typescript-language-server
tailwindcss-language-server
stylua
nixd
# other tools
lua5_1
tree-sitter
ripgrep
gcc
gnumake
imagemagick
luajitPackages.magick
ghostscript
luarocks
(texlive.combine {
inherit (texlive)
scheme-basic
varwidth
preview
mathtools
amsfonts
amscdx
xcolor
dvisvgm
dvipng
wrapfig
standalone
graphicxbox
amsmath
ulem
hyperref
capt-of
;
})
];
nvim-wrapped = pkgs.symlinkJoin {
name = "nvim-with-lsp";
paths = [ pkgs.neovim ];
buildInputs = [ pkgs.makeWrapper ];
postBuild = ''
wrapProgram $out/bin/nvim \
--prefix PATH : ${pkgs.lib.makeBinPath pkgList} \
--set TREE_SITTER_LIB_PATH "${pkgs.tree-sitter}/lib"
'';
};
in
{
packages.${system}.default = nvim-wrapped;
devShells.${system}.default = pkgs.mkShell {
packages = [
nvim-wrapped
];
shellHook = ''
export TREE_SITTER_LIB_PATH="${pkgs.tree-sitter}/lib"
echo "Neovim LSP environment loaded"
export DEVSHELL_NAME="󱄅 flake/#89dceb"
# Trigger zsh
if [[ -z "$ZSH_VERSION" ]]; then
exec zsh
fi
'';
};
};
}