200 lines
5.1 KiB
Nix
200 lines
5.1 KiB
Nix
![]() |
{
|
||
|
config,
|
||
|
lib,
|
||
|
pkgs,
|
||
|
...
|
||
|
}:
|
||
|
with lib; let
|
||
|
cfg = config.coding.editors;
|
||
|
in {
|
||
|
options.coding.editors = {
|
||
|
neovim = {
|
||
|
enable = mkEnableOption "neovim with LazyVim configuration";
|
||
|
};
|
||
|
|
||
|
zed = {
|
||
|
enable = mkEnableOption "zed editor with custom configuration";
|
||
|
};
|
||
|
};
|
||
|
|
||
|
config = mkMerge [
|
||
|
# Neovim configuration
|
||
|
(mkIf cfg.neovim.enable {
|
||
|
programs.neovim = {
|
||
|
enable = true;
|
||
|
defaultEditor = true;
|
||
|
viAlias = true;
|
||
|
vimAlias = true;
|
||
|
vimdiffAlias = true;
|
||
|
withNodeJs = true;
|
||
|
withPython3 = true;
|
||
|
|
||
|
# This is your init.lua content
|
||
|
extraLuaConfig = ''
|
||
|
-- Bootstrap lazy.nvim
|
||
|
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||
|
if not vim.loop.fs_stat(lazypath) then
|
||
|
vim.fn.system({
|
||
|
"git",
|
||
|
"clone",
|
||
|
"--filter=blob:none",
|
||
|
"https://github.com/folke/lazy.nvim.git",
|
||
|
"--branch=stable",
|
||
|
lazypath,
|
||
|
})
|
||
|
end
|
||
|
vim.opt.rtp:prepend(lazypath)
|
||
|
|
||
|
-- Bootstrap LazyVim via lazy.nvim
|
||
|
-- Docs: https://github.com/folke/lazy.nvim and https://www.lazyvim.org/
|
||
|
require("lazy").setup({
|
||
|
spec = {
|
||
|
{ "LazyVim/LazyVim", import = "lazyvim.plugins" },
|
||
|
{ import = "lazyvim.plugins.extras.lang.typescript" },
|
||
|
{ import = "lazyvim.plugins.extras.lang.python" },
|
||
|
{ import = "lazyvim.plugins.extras.lang.go" },
|
||
|
{ import = "lazyvim.plugins.extras.lang.nix" },
|
||
|
{ import = "lazyvim.plugins.extras.lang.rust" },
|
||
|
{ import = "lazyvim.plugins.extras.lang.nushell" },
|
||
|
{ "Mofiqul/dracula.nvim" },
|
||
|
},
|
||
|
defaults = { lazy = false, version = false },
|
||
|
install = { colorscheme = { "dracula", "tokyonight", "habamax" } },
|
||
|
checker = { enabled = false },
|
||
|
performance = {
|
||
|
rtp = {
|
||
|
disabled_plugins = {
|
||
|
"gzip", "tarPlugin", "tohtml", "tutor", "zipPlugin",
|
||
|
},
|
||
|
},
|
||
|
},
|
||
|
})
|
||
|
vim.o.termguicolors = true
|
||
|
vim.cmd.colorscheme("dracula")
|
||
|
'';
|
||
|
};
|
||
|
})
|
||
|
|
||
|
# Zed editor configuration
|
||
|
(mkIf cfg.zed.enable {
|
||
|
programs.zed-editor = {
|
||
|
enable = true;
|
||
|
userSettings = {
|
||
|
# UI and Theme
|
||
|
theme = "Dracula";
|
||
|
ui_font_size = 16;
|
||
|
buffer_font_size = 16;
|
||
|
buffer_font_family = "FiraCode Nerd Font";
|
||
|
|
||
|
# Editor Behavior
|
||
|
vim_mode = true;
|
||
|
auto_update = false;
|
||
|
format_on_save = "on";
|
||
|
load_direnv = "shell_hook";
|
||
|
|
||
|
# AI Features
|
||
|
features = {
|
||
|
edit_prediction_provider = "zed";
|
||
|
};
|
||
|
edit_predictions = {
|
||
|
mode = "subtle";
|
||
|
};
|
||
|
show_edit_predictions = true;
|
||
|
|
||
|
agent = {
|
||
|
default_model = {
|
||
|
provider = "zed.dev";
|
||
|
model = "claude-sonnet-4";
|
||
|
};
|
||
|
};
|
||
|
|
||
|
assistant = {
|
||
|
version = "2";
|
||
|
default_model = {
|
||
|
provider = "anthropic";
|
||
|
model = "claude-4";
|
||
|
};
|
||
|
};
|
||
|
|
||
|
# Language Models
|
||
|
language_models = {
|
||
|
anthropic = {
|
||
|
api_url = "https://api.anthropic.com";
|
||
|
};
|
||
|
openai = {
|
||
|
api_url = "https://api.openai.com/v1";
|
||
|
};
|
||
|
ollama = {
|
||
|
api_url = "http://localhost:11434";
|
||
|
};
|
||
|
};
|
||
|
|
||
|
# Languages Configuration
|
||
|
languages = {
|
||
|
Nix = {
|
||
|
language_servers = ["nixd"];
|
||
|
formatter = {
|
||
|
external = {
|
||
|
command = "alejandra";
|
||
|
arguments = [
|
||
|
"-q"
|
||
|
"-"
|
||
|
];
|
||
|
};
|
||
|
};
|
||
|
};
|
||
|
Python = {
|
||
|
language_servers = ["pyrefly"];
|
||
|
formatter = {
|
||
|
external = {
|
||
|
command = "black";
|
||
|
arguments = ["-"];
|
||
|
};
|
||
|
};
|
||
|
};
|
||
|
};
|
||
|
|
||
|
# LSP Configuration
|
||
|
lsp = {
|
||
|
rust-analyzer = {
|
||
|
initialization_options = {
|
||
|
check = {
|
||
|
command = "clippy";
|
||
|
};
|
||
|
};
|
||
|
};
|
||
|
pyrefly = {
|
||
|
binary = {
|
||
|
arguments = ["--lsp"];
|
||
|
};
|
||
|
};
|
||
|
};
|
||
|
|
||
|
# Context Servers
|
||
|
context_servers = {
|
||
|
some-context-server = {
|
||
|
source = "custom";
|
||
|
command = "some-command";
|
||
|
args = [
|
||
|
"arg-1"
|
||
|
"arg-2"
|
||
|
];
|
||
|
env = {};
|
||
|
};
|
||
|
};
|
||
|
|
||
|
# Privacy
|
||
|
telemetry = {
|
||
|
metrics = false;
|
||
|
};
|
||
|
};
|
||
|
};
|
||
|
})
|
||
|
|
||
|
# Common packages (always installed if either editor is enabled)
|
||
|
(mkIf (cfg.neovim.enable || cfg.zed.enable) {
|
||
|
home.packages = with pkgs; [zig];
|
||
|
})
|
||
|
];
|
||
|
}
|