niksos/modules/tui/helix.nix
2024-08-06 17:46:57 +02:00

104 lines
3.6 KiB
Nix

{
config,
lib,
inputs,
pkgs,
...
}: let
cfg = config.poz.programs.helix;
inherit (config.poz.other.system) username;
inherit (lib.meta) getExe getExe';
inherit (lib.modules) mkIf;
inherit (lib.options) mkEnableOption;
inherit (lib.strings) makeBinPath;
clangd = getExe' pkgs.clang-tools "clangd";
css-languageserver = getExe pkgs.vscode-langservers-extracted;
in {
options.poz.programs.helix.enable = mkEnableOption "helix";
config = mkIf cfg.enable {
home-manager.users.${username} = {
programs.helix = {
enable = true;
package = inputs.helix.packages.${pkgs.system}.default.overrideAttrs (self: {
makeWrapperArgs = with pkgs;
self.makeWrapperArgs
or []
++ [
"--suffix"
"PATH"
":"
(makeBinPath [
rustfmt
rust-analyzer
nil
clang-tools
nodePackages.bash-language-server
vscode-langservers-extracted
])
];
});
settings = {
theme = "catppuccin_mocha";
editor = {
scrolloff = 7;
mouse = false;
middle-click-paste = false;
line-number = "relative";
auto-completion = false;
auto-format = false;
completion-replace = true;
true-color = true;
undercurl = true;
rulers = [ 80 ];
bufferline = "multiple";
color-modes = true;
lsp = {
display-messages = true;
display-inlay-hints = true;
};
cursor-shape = {
normal = "block";
insert = "bar";
select = "underline";
};
auto-pairs = false;
whitespace.render.newline = "all";
indent-guides.render = true;
};
};
languages = {
language-server = {
nil = {
command = getExe pkgs.nil;
config.nil.formatting.command = [ "${getExe pkgs.alejandra}" "-q" ];
};
clangd = {
command = clangd;
clangd.fallbackFlags = [ "-std=c++2b" ];
};
vscode-css-language-server = {
command = "${css-languageserver}";
args = [ "--stdio" ];
};
};
language = [
{
name = "rust";
auto-format = false;
}
{
name = "html";
file-types = [ "html" ];
}
{
name = "c";
}
];
};
};
};
};
}