Remove rustup and bacon from nix tools and the bacon linter mapping that made nvim-lint throw on every Rust buffer. Keep cargo-nextest global for neotest-rust. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
152 lines
3.8 KiB
Nix
152 lines
3.8 KiB
Nix
src:
|
|
{
|
|
config,
|
|
lib,
|
|
pkgs,
|
|
...
|
|
}:
|
|
let
|
|
cfg = config.programs.nvim-config;
|
|
full = cfg.profile == "full";
|
|
|
|
# Slim also needs tree-sitter and a C compiler so its few parsers can compile.
|
|
# On macOS the Xcode clang does that; Nix's clang wrapper would shadow /usr/bin/cc
|
|
# and break cgo links (it can't find SDK libs like -lresolv outside a nix shell).
|
|
baseTools =
|
|
with pkgs;
|
|
[
|
|
ripgrep
|
|
fd
|
|
git
|
|
tree-sitter
|
|
]
|
|
++ lib.optional stdenv.hostPlatform.isLinux stdenv.cc;
|
|
|
|
# The Rust toolchain (cargo, clippy, rustfmt, rust-analyzer) comes from each repo's
|
|
# devenv.nix, so start nvim inside the direnv/devenv shell. cargo-nextest stays here
|
|
# because neotest-rust needs it; it uses the cargo on PATH.
|
|
fullTools = with pkgs; [
|
|
cargo-nextest
|
|
lazygit
|
|
llama-cpp
|
|
|
|
# snacks.image: magick converts, gs renders PDFs, tectonic LaTeX, mmdc mermaid
|
|
imagemagick
|
|
ghostscript
|
|
tectonic
|
|
mermaid-cli
|
|
|
|
nixd
|
|
nixfmt
|
|
lua-language-server
|
|
stylua
|
|
bash-language-server
|
|
shfmt
|
|
shellcheck
|
|
yaml-language-server
|
|
vscode-langservers-extracted
|
|
marksman
|
|
prettierd
|
|
|
|
go
|
|
gopls
|
|
gotools
|
|
gofumpt
|
|
golangci-lint
|
|
delve
|
|
|
|
gomodifytags # gopher.nvim
|
|
gotests
|
|
iferr
|
|
impl
|
|
|
|
tinymist # typst LSP and typst-preview.nvim
|
|
websocat
|
|
typst
|
|
|
|
vtsls
|
|
vscode-js-debug
|
|
|
|
basedpyright
|
|
ruff
|
|
|
|
intelephense # unfree: the host must allow it
|
|
phpPackages.php-cs-fixer
|
|
phpstan
|
|
jq # json formatter
|
|
];
|
|
|
|
# Kept out of home.packages to avoid colliding with other pythons/nodes.
|
|
debugpy = pkgs.python3.withPackages (ps: [ ps.debugpy ]);
|
|
lldb = pkgs.vscode-extensions.vadimcn.vscode-lldb;
|
|
phpDebug = pkgs.vscode-extensions.xdebug.php-debug;
|
|
in
|
|
{
|
|
options.programs.nvim-config = {
|
|
enable = lib.mkEnableOption "the nvim-config Neovim setup";
|
|
|
|
profile = lib.mkOption {
|
|
type = lib.types.enum [
|
|
"full"
|
|
"slim"
|
|
];
|
|
default = "full";
|
|
description = "full for dev machines, slim for servers.";
|
|
};
|
|
|
|
checkout = lib.mkOption {
|
|
type = lib.types.nullOr lib.types.str;
|
|
default = null;
|
|
example = "/Users/johannes/Repos/nvim";
|
|
description = ''
|
|
Absolute path to a local checkout. When set, ~/.config/nvim links to it
|
|
out of store so edits apply without a switch. When null, it links to
|
|
the flake source in the Nix store.
|
|
'';
|
|
};
|
|
|
|
minuetEndpoint = lib.mkOption {
|
|
type = lib.types.str;
|
|
default = "http://127.0.0.1:11434";
|
|
description = "Base URL of the Ollama (or llama-server) used for AI completion.";
|
|
};
|
|
|
|
agent = {
|
|
command = lib.mkOption {
|
|
type = lib.types.str;
|
|
default = "agent";
|
|
description = "Command sidekick.nvim runs for the agent tool.";
|
|
};
|
|
package = lib.mkOption {
|
|
type = lib.types.nullOr lib.types.package;
|
|
default = null;
|
|
description = "Package providing the agent binary.";
|
|
};
|
|
};
|
|
};
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
home.packages = [
|
|
pkgs.neovim
|
|
]
|
|
++ baseTools
|
|
++ lib.optionals full fullTools
|
|
++ lib.optional (full && cfg.agent.package != null) cfg.agent.package;
|
|
|
|
home.sessionVariables = {
|
|
NVIM_PROFILE = cfg.profile;
|
|
}
|
|
// lib.optionalAttrs full {
|
|
MINUET_ENDPOINT = cfg.minuetEndpoint;
|
|
NVIM_AGENT_CMD = cfg.agent.command;
|
|
NVIM_CODELLDB = "${lldb}/share/vscode/extensions/vadimcn.vscode-lldb/adapter/codelldb";
|
|
NVIM_DEBUGPY_PYTHON = "${debugpy}/bin/python3";
|
|
NVIM_PHP_DEBUG = "${phpDebug}/share/vscode/extensions/xdebug.php-debug/out/phpDebug.js";
|
|
NVIM_NODE = "${pkgs.nodejs}/bin/node";
|
|
};
|
|
|
|
xdg.configFile."nvim".source =
|
|
if cfg.checkout != null then config.lib.file.mkOutOfStoreSymlink cfg.checkout else src;
|
|
};
|
|
}
|