helix module remove redudancy

This commit is contained in:
do butterflies cry? 2026-01-29 14:39:59 +10:00
parent 51a67d039f
commit ba1a3fe07e
3 changed files with 74 additions and 66 deletions

View file

@ -1,5 +1,55 @@
{pkgs, ...}: { {
# read https://docs.helix-editor.com/editor.html pkgs,
pkgs-unstable,
...
}: let
lsps = let
mkLsp = pkg: path: {inherit pkg path;};
in {
bash-language-server =
mkLsp
pkgs.bash-language-server
"/bin/bash-language-server";
clangd =
mkLsp
pkgs.clang-tools
"/bin/clangd";
haskell-language-server =
mkLsp
pkgs.haskell-language-server
"/bin/haskell-language-server-wrapper";
# TODO: once upgraded past Nix-24.07 this line won't be necessary (I think)
# helix will support nixd by default
# SOURCE: https://github.com/nix-community/nixd/blob/main/nixd/docs/editor-setup.md#Helix
nixd =
mkLsp
pkgs.nixd
"/bin/nixd";
OmniSharp =
mkLsp
pkgs.omnisharp-roslyn
"/bin/OmniSharp";
rust-analyzer =
mkLsp
pkgs.rust-analyzer
"/bin/rust-analyzer";
ty =
mkLsp
pkgs.ty
"/bin/ty";
};
in {
environment.systemPackages =
lsps
|> map (lsp: lsp.pkg);
# REF: https://docs.helix-editor.com/editor.html
programs.helix = { programs.helix = {
enable = true; enable = true;
settings = { settings = {
@ -128,11 +178,12 @@
}; };
auto-format = false; # my python is beautiful ^_^ auto-format = false; # my python is beautiful ^_^
rulers = [80]; rulers = [80];
language-servers = ["ty"];
} }
{ {
name = "c"; name = "c";
file-types = ["c" "h"]; # use .hpp for C++ file-types = ["c" "h"]; # use .hpp for C++
auto-format = false; auto-format = true;
formatter.command = "${pkgs.clang-tools}/bin/clang-format"; formatter.command = "${pkgs.clang-tools}/bin/clang-format";
language-servers = ["clangd"]; language-servers = ["clangd"];
} }
@ -152,49 +203,27 @@
formatter.command = "${pkgs.rustfmt}/bin/rustfmt"; formatter.command = "${pkgs.rustfmt}/bin/rustfmt";
language-servers = ["rust-analyzer"]; language-servers = ["rust-analyzer"];
} }
# { {
# name = "c-sharp"; name = "c-sharp";
# source = "source.cs"; source = "source.cs";
# file-types = ["cs"]; file-types = ["cs"];
# indent = { indent = {
# tab-width = 4; tab-width = 4;
# unit = " "; unit = " ";
# }; };
# block-comment-tokens = { block-comment-tokens = {
# start = "/*"; start = "/*";
# end = "*/"; end = "*/";
# }; };
# # auto-format = false; # auto-format = false;
# # formatter.command = "${pkgs.omnisharp-roslyn}/bin/OmniSharp"; # formatter.command = "${pkgs.omnisharp-roslyn}/bin/OmniSharp";
# # language-servers = ["OmniSharp"]; # language-servers = ["OmniSharp"];
# } }
]; ];
language-server = { language-server =
# use nixd as default nix lsp (I haven't tried nil yet) lsps
# NOTE: nixd will be supported by default after nix 24.07 |> builtins.mapAttrs (_: lsp: "${lsp.pkg}${lsp.path}");
# SOURCE: https://github.com/nix-community/nixd/blob/main/nixd/docs/editor-setup.md#Helix
nixd = {
command = "${pkgs.nixd}/bin/nixd";
};
# clangd for C
clangd = {
command = "${pkgs.clang-tools}/bin/clangd";
};
haskell-language-server = {
command = "${pkgs.haskell-language-server}/bin/haskell-language-server-wrapper";
};
rust-analyzer = {
command = "${pkgs.rust-analyzer}/bin/rust-analyzer";
};
# C# language services
OmniSharp = {
command = "${pkgs.omnisharp-roslyn}/bin/OmniSharp";
};
};
}; };
}; };
} }

View file

@ -296,13 +296,12 @@ in {
# C Family # C Family
gcc gcc
clang clang
clang-tools clang-tools
# Rust # Rust
cargo cargo
rustc rustc
rustfmt rustfmt
rust-analyzer
# Go # Go
go go
# Nim # Nim
@ -311,14 +310,9 @@ in {
# Haskell # Haskell
ghc ghc
ghcid ghcid
haskell-language-server
ormolu ormolu
# Nix # Nix
# TODO: once upgraded past Nix-24.07 this line won't be necessary (I think)
# helix will support nixd by default
# SOURCE: https://github.com/nix-community/nixd/blob/main/nixd/docs/editor-setup.md#Helix
nixd # lsp for nix
nix-prefetch-git nix-prefetch-git
nix-index nix-index
nix-unit nix-unit

View file

@ -307,19 +307,9 @@ in {
# Haskell # Haskell
ghc ghc
ghcid ghcid
haskell-language-server
ormolu ormolu
# Java # Java
# jdk17
# (jre8.overrideAttrs
# (oldAttrs: {
# enableJavaFX = true;
# }))
# (jdk8.overrideAttrs
# (oldAttrs: {
# enableJavaFX = true;
# }))
visualvm visualvm
# Python # Python
@ -357,11 +347,6 @@ in {
tesseract # for my work with Agribit tesseract # for my work with Agribit
# TODO: once upgraded past Nix-24.07 this line won't be necessary (I think)
# helix will support nixd by default
# SOURCE: https://github.com/nix-community/nixd/blob/main/nixd/docs/editor-setup.md#Helix
# nixd # lsp for nix # DEBUG
# Pretty necessary # Pretty necessary
git git
git-filter-repo git-filter-repo