feat: initial commit
- basic config according to spec
This commit is contained in:
commit
9b0446c5f6
36 files changed
+1114
No files matched your search
+131
@@ -0,0 +1,131 @@
|
||||
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.
|
||||
baseTools = with pkgs; [
|
||||
ripgrep
|
||||
fd
|
||||
git
|
||||
tree-sitter
|
||||
stdenv.cc
|
||||
];
|
||||
|
||||
# rustup supplies cargo, rustfmt, clippy and rust-analyzer (and the nightly
|
||||
# toolchain fff builds with), so those are not listed separately.
|
||||
fullTools = with pkgs; [
|
||||
lazygit
|
||||
rustup
|
||||
cargo-nextest
|
||||
llama-cpp
|
||||
|
||||
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
|
||||
|
||||
vtsls
|
||||
vscode-js-debug
|
||||
|
||||
basedpyright
|
||||
ruff
|
||||
|
||||
intelephense # unfree: the host must allow it
|
||||
phpPackages.php-cs-fixer
|
||||
phpPackages.phpstan
|
||||
];
|
||||
|
||||
# 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:8012";
|
||||
description = "Base URL of the 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;
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user