move helix as home module, provide option youthlic.programs.helix.

This commit is contained in:
Ulic-youthlic 2025-01-10 16:33:08 +08:00
parent aa4a261a04
commit 445dfe6543
5 changed files with 63 additions and 20 deletions

View file

@ -6,6 +6,7 @@
])
++ [
./nix.nix
./helix
];
options = {

View file

@ -0,0 +1,84 @@
theme = "ayu_evolve"
[editor]
line-number = "relative"
cursorline = true
cursorcolumn = false
true-color = true
undercurl = true
bufferline = "multiple"
color-modes = true
default-line-ending = "lf"
popup-border = "all"
[editor.statusline]
left = [
"mode",
"spacer",
"version-control",
"file-type",
"separator",
"read-only-indicator",
"file-name",
"file-modification-indicator",
"spacer",
"spinner",
]
center = ["diagnostics"]
right = [
"register",
"file-line-ending",
"file-encoding",
"separator",
"total-line-numbers",
"position",
"position-percentage",
]
separator = "|"
mode.normal = "NORMAL"
mode.insert = "INSERT"
mode.select = "SELECT"
[editor.lsp]
display-messages = true
display-inlay-hints = true
[editor.cursor-shape]
insert = "bar"
normal = "block"
select = "underline"
[editor.file-picker]
hidden = false
[editor.auto-save]
focus-lost = true
after-delay.enable = true
[editor.whitespace.render]
space = "all"
tab = "all"
newline = "none"
[editor.whitespace.characters]
space = "·"
nbsp = "⍽"
tab = "→"
newline = "⏎"
tabpad = "·"
[editor.indent-guides]
render = true
[editor.gutters]
layout = ["diagnostics", "spacer", "line-numbers", "spacer", "diff"]
line-numbers.min-width = 1
[editor.soft-wrap]
enable = true
wrap-at-text-width = true
[editor.inline-diagnostics]
cursor-line = "hint"
other-lines = "error"
prefix-len = 2

View file

@ -0,0 +1,56 @@
{
lib,
pkgs,
config,
...
}:
{
options = {
youthlic.programs.helix = {
enable = lib.mkOption {
type = lib.types.bool;
default = true;
example = false;
description = ''
enable helix editor
'';
};
extraPackages = lib.mkOption {
type = lib.types.listOf lib.types.package;
default = with pkgs; [
taplo
markdown-oxide
nixd
deno
nixfmt-rfc-style
];
example = (
with pkgs;
[
deno
]
);
description = ''
extra packages for helix lsp and formatter
'';
};
};
};
config =
let
cfg = config.youthlic.programs.helix;
in
{
programs.helix = lib.mkIf cfg.enable {
enable = true;
defaultEditor = true;
settings =
let
config-file = builtins.readFile ./config.toml;
config = builtins.fromTOML config-file;
in
config;
};
home.packages = cfg.extraPackages;
};
}