Modularized helix

This commit is contained in:
Timo Boomers 2025-05-09 12:18:16 +02:00
parent 42cab14829
commit 5c78d0c1f5
Signed by: xeovalyte
SSH Key Fingerprint: SHA256:GWI1hq+MNKR2UOcvk7n9tekASXT8vyazK7vDF9Xyciw
2 changed files with 88 additions and 58 deletions

View File

@ -18,7 +18,15 @@
applications.devenv.enable = true;
applications.firefox.enable = true;
applications.git.enable = true;
applications.helix.enable = true;
applications.helix = {
enable = true;
markdown = true;
rust = true;
systemverilog = true;
nix = true;
latex = true;
vue = true;
};
applications.zsh.enable = true;
applications.ssh.enable = true;
applications.thunderbird.enable = true;
@ -51,6 +59,7 @@
unstable.prusa-slicer
unstable.surfer # waveform viewer
pomodoro-gtk
# Office
libreoffice

View File

@ -12,37 +12,68 @@ in {
Enable helix text editor
'';
};
settings.applications.helix.markdown = lib.mkOption {
type = lib.types.bool;
default = false;
description = ''
Enable markdown language support
'';
};
settings.applications.helix.systemverilog = lib.mkOption {
type = lib.types.bool;
default = false;
description = ''
Enable systemverilog language support
'';
};
settings.applications.helix.nix = lib.mkOption {
type = lib.types.bool;
default = true;
description = ''
Enable nix language support
'';
};
settings.applications.helix.latex = lib.mkOption {
type = lib.types.bool;
default = true;
description = ''
Enable latex language support
'';
};
settings.applications.helix.vue = lib.mkOption {
type = lib.types.bool;
default = true;
description = ''
Enable vue/nuxt language support
'';
};
settings.applications.helix.rust = lib.mkOption {
type = lib.types.bool;
default = false;
description = ''
Enable rust language support
'';
};
};
config = mkIf cfg.enable {
home.packages = with pkgs; [
# Markdown
unstable.marksman
unstable.markdown-oxide
dprint
# Systemverilog
unstable.svls
# Assembly
unstable.asm-lsp
# Nixos
unstable.nil
unstable.nixpkgs-fmt
# Latex
tectonic
unstable.texlab
# Vue/Nuxt
unstable.vue-language-server
unstable.typescript
unstable.typescript-language-server
home.packages = with pkgs; lib.concatLists [
(lib.optionals cfg.markdown [ unstable.marksman unstable.markdown-oxide dprint ])
(lib.optionals cfg.systemverilog [ unstable.svls ])
(lib.optionals cfg.nix [ unstable.nix unstable.nixpkgs-fmt ])
(lib.optionals cfg.latex [ tectonic unstable.texlab ])
(lib.optionals cfg.vue [ unstable.vue-language-server unstable.typescript unstable.typescript-language-server ])
];
# Markdown
home.file.".config/.dprint.json".text =''
home.file.".config/.dprint.json" = lib.mkIf cfg.markdown {
text = ''
{
"markdown": {
"lineWidth":120,
@ -53,6 +84,7 @@ in {
]
}
'';
};
programs.helix = {
enable = true;
@ -65,24 +97,19 @@ in {
};
languages = {
# Rust
language-server.rust-analyzer.config = {
language-server.rust-analyzer.config = lib.mkIf cfg.rust {
cargo = {
features = "all";
};
};
# Systemverilog
language-server.svls = {
language-server.svls = lib.mkIf cfg.systemverilog {
command = "svls";
};
# Systemverilog
language-server.asm = {
command = "asm-lsp";
};
# Latex
language-server.texlab = {
language-server.texlab = lib.mkIf cfg.latex {
config = {
texlab.chktex = {
onOpenAndSave = true;
@ -116,7 +143,7 @@ in {
};
};
language-server.typescript-language-server.config = {
language-server.typescript-language-server.config = lib.mkIf cfg.vue {
# tsserver = {
# path = "${pkgs.unstable.typescript}/bin/tsserver";
# };
@ -148,18 +175,12 @@ in {
# };
# };
language = [
{
language = lib.concatLists [
(lib.optionals cfg.systemverilog [{
name = "verilog";
language-servers = [ "svls" ];
}
{
name = "asm";
scope = "source.s";
language-servers = [ "asm" ];
file-types = [ "s" "S" ];
}
{
}])
(lib.optionals cfg.markdown [{
name = "markdown";
auto-format = true;
language-servers = [ "markdown-oxide" ];
@ -170,11 +191,11 @@ in {
name = "typst";
auto-format = false;
formatter.command = "${pkgs.typstfmt}/bin/typstfmt";
}
{
}])
(lib.optionals cfg.vue [{
name = "vue";
language-servers = ["vuels" "typescript-language-server"];
}
}])
];
};
};