nichts/packages/helix/default.nix
Bloxx12 e641dfa114
treewide: format using nixfmt
Signed-off-by: Bloxx12 <charlie@charlieroot.dev>
Change-Id: I6a6a69641c36f9763e104087a559c148d0449f00
2025-07-20 02:14:32 +02:00

220 lines
4.6 KiB
Nix

{
sources,
basedpyright,
bash-language-server,
callPackage,
clang-tools,
clippy,
cmake-format,
cmake-language-server,
deadnix,
deno,
dprint,
fetchzip,
formats,
gdb,
golangci-lint-langserver,
gopls,
helix,
kdePackages,
kdlfmt,
lazygit,
lib,
lldb_19,
makeWrapper,
nixd,
ruff,
rust-analyzer,
rustPlatform,
rustfmt,
shellcheck,
shfmt,
simple-completion-language-server,
superhtml,
symlinkJoin,
taplo,
tinymist,
typescript-language-server,
vscode-langservers-extracted,
zls,
...
}:
let
inherit (lib.meta) getExe;
custom-helix = helix.overrideAttrs (
finalAttrs: previousAttrs: {
version = "25.07.2";
src = fetchzip {
url = "https://github.com/bloxx12/helix/releases/download/${finalAttrs.version}/helix-${finalAttrs.version}-source.tar.xz";
hash = "sha256-ZNsQwFfPXe6oewajx1tl68W60kVo7q2SuvTgy/o1HKk=";
stripRoot = false;
};
doInstallCheck = false;
cargoDeps = rustPlatform.fetchCargoVendor {
inherit (custom-helix) src;
hash = "sha256-3poZSvIrkx8lguxxDeNfngW6+4hH8TV/LHcZx5W5aXg=";
};
}
);
toml = formats.toml { };
helix-languages = callPackage ./languages.nix { inherit lib sources; };
colorscheme = toml.generate "colorscheme.toml" (import ./colorscheme.nix);
helix-config = {
theme = "theme_transparent";
editor = {
cursorline = false;
color-modes = true;
true-color = true;
indent-guides.render = true;
lsp = {
enable = true;
auto-signature-help = true;
display-inlay-hints = false;
display-messages = true;
snippets = true;
};
file-picker = {
hidden = true;
};
line-number = "relative";
auto-format = true;
completion-timeout = 5;
mouse = true;
bufferline = "multiple";
soft-wrap.enable = true;
word-completion = {
enable = true;
trigger-length = 2;
};
cursor-shape = {
insert = "bar";
normal = "block";
select = "underline";
};
statusline = {
left = [
"spinner"
"version-control"
"diagnostics"
"file-name"
];
right = [
"file-base-name"
"file-type"
"position"
"file-encoding"
];
};
gutters.layout = [
"diff"
"diagnostics"
"line-numbers"
"spacer"
];
inline-diagnostics = {
cursor-line = "hint";
other-lines = "error";
};
};
keys = {
normal = {
space = {
g = [
":new"
":insert-output XDG_CONFIG_HOME=~/.config ${getExe lazygit}"
":buffer-close!"
":redraw"
];
i = ":toggle lsp.display-inlay-hints";
};
esc = [
"collapse_selection"
"keep_primary_selection"
"normal_mode"
];
A-H = "goto_previous_buffer";
A-L = "goto_next_buffer";
A-w = ":buffer-close";
A-f = ":format";
A-r = ":reload";
A-x = "extend_to_line_bounds";
X = [
"extend_line_up"
"extend_to_line_bounds"
];
";" = "flip_selections";
"A-;" = "collapse_selection";
# Kakoune-like config
H = "extend_char_left";
J = "extend_line_down";
K = "extend_line_up";
L = "extend_char_right";
};
select = {
A-x = "extend_to_line_bounds";
X = [
"extend_line_up"
"extend_to_line_bounds"
];
g = {
e = "goto_file_end";
};
};
};
};
wrapped-helix = symlinkJoin {
name = "helix-wrapped";
paths = [
custom-helix
# Bash
bash-language-server
# C/C++
clang-tools
clippy
golangci-lint-langserver
gopls
lldb_19
# Markdown
taplo
nixd
rust-analyzer
rustfmt
# Shell
shellcheck
kdlfmt
superhtml
# toml
taplo
# typst
tinymist
# typst lsp
vscode-langservers-extracted
kdlfmt
# zig language server
zls
];
nativeBuildInputs = [ makeWrapper ];
postBuild = ''
mkdir -p $out/config/helix/themes
cp "${toml.generate "config.toml" helix-config}" $out/config/helix/config.toml
cp "${helix-languages}" $out/config/helix/languages.toml
cp "${colorscheme}" $out/config/helix/themes/theme_transparent.toml
wrapProgram $out/bin/hx --set \
XDG_CONFIG_HOME $out/config
'';
};
in
wrapped-helix