chore: split up helix into multiple packages

This commit is contained in:
Bloxx12 2025-05-09 09:54:11 +02:00
commit 88c73558f4
Signed by: faukah
SSH key fingerprint: SHA256:Uj2AXqvtdCA4hn5Hq0ZonhIAyUqI1q4w2sMG3Z1TH7E
4 changed files with 154 additions and 125 deletions

View file

@ -2,7 +2,7 @@
pkgs, pkgs,
helix, helix,
}: let }: let
wrapped-helix = pkgs.callPackage ./helix.nix {inherit helix;}; wrapped-helix = pkgs.callPackage ./helix {inherit helix;};
kakoune = pkgs.callPackage ./kakoune.nix {}; kakoune = pkgs.callPackage ./kakoune.nix {};
fish = pkgs.callPackage ./shell {}; fish = pkgs.callPackage ./shell {};
in { in {

View file

151
packages/helix/default.nix Normal file
View file

@ -0,0 +1,151 @@
{
symlinkJoin,
makeWrapper,
callPackage,
alejandra,
basedpyright,
bash-language-server,
clang-tools,
clippy,
cmake-format,
cmake-language-server,
deno,
dprint,
formats,
gdb,
golangci-lint-langserver,
gopls,
lazygit,
lib,
lldb_19,
marksman,
nil,
nixd,
ruff,
rust-analyzer,
rustfmt,
shellcheck,
shfmt,
superhtml,
kdePackages,
taplo,
tinymist,
typescript-language-server,
vscode-langservers-extracted,
simple-completion-language-server,
helix,
...
}: let
inherit (lib.meta) getExe;
toml = formats.toml {};
helix-config = {
theme = "catppuccin_mocha";
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;
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";};
};
};
};
helix-languages = callPackage ./languages.nix {inherit lib;};
wrapped-helix = symlinkJoin {
name = "helix-wrapped";
paths = [
helix
# Bash
bash-language-server
# C/C++
clang-tools
clippy
golangci-lint-langserver
gopls
lldb_19
# Markdown
marksman
# Nix
nil
nixd
rust-analyzer
rustfmt
# Shell
shellcheck
superhtml
# toml
taplo
# typst
tinymist
# typst lsp
vscode-langservers-extracted
];
nativeBuildInputs = [makeWrapper];
postBuild = ''
mkdir -p $out/config/helix
cp "${toml.generate "config.toml" helix-config}" $out/config/helix/config.toml
cp "${helix-languages}" $out/config/helix/languages.toml
wrapProgram $out/bin/hx --set \
XDG_CONFIG_HOME $out/config
'';
};
in
wrapped-helix

View file

@ -1,111 +1,28 @@
{ {
symlinkJoin,
makeWrapper,
alejandra, alejandra,
basedpyright, basedpyright,
bash-language-server, bash-language-server,
clang-tools, clang-tools,
clippy,
cmake-format, cmake-format,
cmake-language-server, cmake-language-server,
deno, deno,
dprint, dprint,
formats, formats,
gdb, gdb,
golangci-lint-langserver,
gopls,
lazygit,
lib, lib,
lldb_19,
marksman,
nil, nil,
nixd,
ruff, ruff,
rust-analyzer,
rustfmt,
shellcheck,
shfmt, shfmt,
superhtml,
kdePackages, kdePackages,
taplo,
tinymist,
typescript-language-server, typescript-language-server,
vscode-langservers-extracted, vscode-langservers-extracted,
simple-completion-language-server, simple-completion-language-server,
helix,
... ...
}: let }: let
inherit (lib.meta) getExe; inherit (lib.meta) getExe;
toml = formats.toml {}; toml = formats.toml {};
helix-config = {
theme = "catppuccin_mocha";
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;
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";};
};
};
};
helix-languages = { helix-languages = {
language = let language = let
mark = lang: { mark = lang: {
@ -158,7 +75,7 @@
} }
{ {
name = "nix"; name = "nix";
language-servers = ["nil" "scls"]; language-servers = ["nil" "scls" "deadnix"];
} }
{ {
name = "qml"; name = "qml";
@ -318,44 +235,5 @@
}; };
}; };
}; };
wrapped-helix = symlinkJoin {
name = "helix-wrapped";
paths = [
helix
# Bash
bash-language-server
# C/C++
clang-tools
clippy
golangci-lint-langserver
gopls
lldb_19
# Markdown
marksman
# Nix
nil
nixd
rust-analyzer
rustfmt
# Shell
shellcheck
superhtml
# toml
taplo
# typst
tinymist
# typst lsp
vscode-langservers-extracted
];
nativeBuildInputs = [makeWrapper];
postBuild = ''
mkdir -p $out/config/helix
cp "${toml.generate "config.toml" helix-config}" $out/config/helix/config.toml
cp "${toml.generate "languages.toml" helix-languages}" $out/config/helix/languages.toml
wrapProgram $out/bin/hx --set \
XDG_CONFIG_HOME $out/config
'';
};
in in
wrapped-helix toml.generate "languages.toml" helix-languages