neovim/nix/package.nix

65 lines
1.3 KiB
Nix

{ pkgs, lib, ... }:
let
deps = with pkgs; [
lua
# Language Servers
rust-analyzer
nil
pyright
bash-language-server
lua-language-server
zls
typescript
nodePackages_latest.typescript-language-server
kdePackages.qtdeclarative # QML formatter
# Formatter
python311Packages.black # Python formatter
clang-tools
nodePackages_latest.prettier # JSON, JS, TS formatter
yamlfmt # YAML formatter
taplo # TOML formatter
rustfmt # Rust formatter
shfmt # Shell, Bash etc.
nixfmt-rfc-style
stylua # lua formatter
# Misc
ripgrep
rustc
cargo
nodejs_22
clang
tree-sitter
fd
luajitPackages.luarocks
wl-clipboard
];
in
pkgs.writeTextFile {
name = "nvim";
executable = true;
destination = "/bin/nvim";
text = ''
#!${pkgs.bash}/bin/bash
export PATH=${lib.makeBinPath deps}:$PATH
if [ -z $${TMP_PROJECT_ROOT+x} ]; then
export LUA_PATH=${../.}/lua/?.lua;
export CONFIG_LOC=${../init.lua}
else
export LUA_PATH="$TMP_PROJECT_ROOT/lua/?.lua";
export CONFIG_LOC="$TMP_PROJECT_ROOT/init.lua"
fi
${pkgs.neovim-unwrapped}/bin/nvim -u $CONFIG_LOC $@
'';
checkPhase = ''
${pkgs.stdenv.shellDryRun} "$target"
'';
meta = pkgs.neovim.meta // {
mainProgram = "nvim";
};
}