refactor: inputs/ --> {sys,home}/

This commit is contained in:
ooks-io 2024-05-26 14:57:35 +12:00
parent 8f22a24963
commit f77c627980
225 changed files with 77 additions and 88 deletions

View file

@ -0,0 +1,68 @@
{ inputs, config, pkgs, lib, ... }:
let
cfg = config.homeModules.console.editor.helix;
inherit (config) colorscheme;
in
{
imports = [
./languages.nix
];
config = lib.mkIf cfg.enable {
programs.helix = {
enable = true;
defaultEditor = lib.mkIf cfg.default true;
package = inputs.helix.packages.${pkgs.system}.default.overrideAttrs (old: {
makeWrapperArgs = with pkgs;
old.makeWrapperArgs
or []
++ [
"--suffix"
"PATH"
":"
(lib.makeBinPath [
clang-tools
marksman
nil
nodePackages.bash-language-server
nodePackages.vscode-css-languageserver-bin
nodePackages.vscode-langservers-extracted
shellcheck
])
];
});
settings = {
theme = colorscheme.slug;
editor = {
color-modes = true;
middle-click-paste = false;
line-number = "relative";
indent-guides.render = true;
true-color = true;
cursorline = true;
cursor-shape = {
normal = "block";
insert = "bar";
select = "underline";
};
statusline = {
left = [ "mode" "spinner" ];
center = [ "file-name" ];
right = [ "diagnostics" "selections" "position" "file-encoding" "file-line-ending" "file-type" ];
};
lsp = {
display-messages = true;
display-inlay-hints = true;
};
};
keys.normal.space.u = {
f = ":format";
w = ":set whitespace.render all";
W = ":set whitespace.render none";
};
};
themes = import ./theme.nix { inherit colorscheme; };
};
};
}

View file

@ -0,0 +1,142 @@
{ pkgs, lib, config, ... }:
let
cfg = config.homeModules.console.editor.helix;
in
{
config = lib.mkIf cfg.enable {
programs.helix.languages = {
language = let
deno = lang: {
command = "${pkgs.deno}/bin/deno";
args = ["fmt" "-" "--ext" lang];
};
prettier = lang: {
command = "${pkgs.nodePackages.prettier}/bin/prettier";
args = ["--parser" lang];
};
prettierLangs = map (e: {
name = e;
formatter = prettier e;
});
langs = ["css" "scss" "html"];
in
[
{
name = "bash";
auto-format = true;
formatter = {
command = "${pkgs.shfmt}/bin/shfmt";
args = ["-i" "2"];
};
}
{
name = "clojure";
injection-regex = "(clojure|clj|edn|boot|yuck)";
file-types = ["clj" "cljs" "cljc" "clje" "cljr" "cljx" "edn" "boot" "yuck"];
}
{
name = "javascript";
auto-format = true;
language-servers = ["dprint" "typescript-language-server"];
}
{
name = "json";
formatter = deno "json";
}
{
name = "markdown";
auto-format = true;
formatter = deno "md";
}
]
++ prettierLangs langs;
language-server = {
bash-language-server = {
command = "${pkgs.nodePackages.bash-language-server}/bin/bash-language-server";
args = ["start"];
};
clangd = {
command = "${pkgs.clang-tools}/bin/clangd";
clangd.fallbackFlags = ["-std=c++2b"];
};
deno-lsp = {
command = "${pkgs.deno}/bin/deno";
args = ["lsp"];
environment.NO_COLOR = "1";
config.deno = {
enable = true;
lint = true;
unstable = true;
suggest = {
completeFunctionCalls = false;
imports = {hosts."https://deno.land" = true;};
};
inlayHints = {
enumMemberValues.enabled = true;
functionLikeReturnTypes.enabled = true;
parameterNames.enabled = "all";
parameterTypes.enabled = true;
propertyDeclarationTypes.enabled = true;
variableTypes.enabled = true;
};
};
};
nil = {
command = lib.getExe pkgs.nil;
config.nil.formatting.command = ["${lib.getExe pkgs.alejandra}" "-q"];
};
dprint = {
command = lib.getExe pkgs.dprint;
args = ["lsp"];
};
typescript-language-server = {
command = "${pkgs.nodePackages.typescript-language-server}/bin/typescript-language-server";
args = ["--stdio"];
config = let
inlayHints = {
includeInlayEnumMemberValueHints = true;
includeInlayFunctionLikeReturnTypeHints = true;
includeInlayFunctionParameterTypeHints = true;
includeInlayParameterNameHints = "all";
includeInlayParameterNameHintsWhenArgumentMatchesName = true;
includeInlayPropertyDeclarationTypeHints = true;
includeInlayVariableTypeHints = true;
};
in {
typescript-language-server.source = {
addMissingImports.ts = true;
fixAll.ts = true;
organizeImports.ts = true;
removeUnusedImports.ts = true;
sortImports.ts = true;
};
typescript = {inherit inlayHints;};
javascript = {inherit inlayHints;};
hostInfo = "helix";
};
};
vscode-css-language-server = {
command = "${pkgs.nodePackages.vscode-css-languageserver-bin}/bin/css-languageserver";
args = ["--stdio"];
config = {
provideFormatter = true;
css.validate.enable = true;
scss.validate.enable = true;
};
};
};
};
};
}

View file

@ -0,0 +1,73 @@
{ colorscheme }: {
"${colorscheme.slug}" = {
palette = builtins.mapAttrs (name: value: "#${value}") colorscheme.colors; # Add leading '#'
"attributes" = "base09";
"comment" = { fg = "base03"; modifiers = [ "italic" ]; };
"constant" = "base09";
"constant.character.escape" = "base0C";
"constant.numeric" = "base09";
"constructor" = "base0D";
"debug" = "base03";
"diagnostic" = { modifiers = [ "underlined" ]; };
"diagnostic.error" = { underline = { style = "curl"; }; };
"diagnostic.hint" = { underline = { style = "curl"; }; };
"diagnostic.info" = { underline = { style = "curl"; }; };
"diagnostic.warning" = { underline = { style = "curl"; }; };
"diff.delta" = "base09";
"diff.minus" = "base08";
"diff.plus" = "base0B";
"error" = "base08";
"function" = "base0D";
"hint" = "base03";
"info" = "base0D";
"keyword" = "base0E";
"label" = "base0E";
"markup.bold" = { fg = "base0A"; modifiers = [ "bold" ]; };
"markup.heading" = "base0D";
"markup.italic" = { fg = "base0E"; modifiers = [ "italic" ]; };
"markup.link.text" = "base08";
"markup.link.url" = { fg = "base09"; modifiers = [ "underlined" ]; };
"markup.list" = "base08";
"markup.quote" = "base0C";
"markup.raw" = "base0B";
"markup.strikethrough" = { modifiers = [ "crossed_out" ]; };
"namespace" = "base0E";
"operator" = "base05";
"special" = "base0D";
"string" = "base0B";
"type" = "base0A";
"ui.background" = { bg = "base00"; };
"ui.bufferline" = { fg = "base04"; bg = "base00"; };
"ui.bufferline.active" = { fg = "base00"; bg = "base03"; modifiers = [ "bold" ]; };
"ui.cursor" = { fg = "base04"; modifiers = [ "reversed" ]; };
"ui.cursor.insert" = { fg = "base0A"; modifiers = [ "underlined" ]; };
"ui.cursor.match" = { fg = "base0A"; modifiers = [ "underlined" ]; };
"ui.cursor.select" = { fg = "base0A"; modifiers = [ "underlined" ]; };
"ui.cursorline.primary" = { fg = "base05"; bg = "base01"; };
"ui.gutter" = { bg = "base00"; };
"ui.help" = { fg = "base06"; bg = "base01"; };
"ui.linenr" = { fg = "base03"; bg = "base00"; };
"ui.linenr.selected" = { fg = "base04"; bg = "base01"; modifiers = [ "bold" ]; };
"ui.menu" = { fg = "base05"; bg = "base01"; };
"ui.menu.scroll" = { fg = "base03"; bg = "base01"; };
"ui.menu.selected" = { fg = "base01"; bg = "base04"; };
"ui.popup" = { bg = "base01"; };
"ui.selection" = { bg = "base02"; };
"ui.selection.primary" = { bg = "base02"; };
"ui.statusline" = { fg = "base0B"; bg = "base02"; };
"ui.statusline.inactive" = { bg = "base01"; fg = "base02"; };
"ui.statusline.insert" = { fg = "base00"; bg = "base0B"; };
"ui.statusline.normal" = { fg = "base00"; bg = "base04"; };
"ui.statusline.select" = { fg = "base00"; bg = "base0E"; };
"ui.text" = "base05";
"ui.text.focus" = "base05";
"ui.virtual.indent-guide" = { fg = "base03"; };
"ui.virtual.ruler" = { bg = "base01"; };
"ui.virtual.whitespace" = { fg = "base01"; };
"ui.window" = { bg = "base01"; };
"variable" = "base08";
"variable.other.member" = "base08";
"warning" = "base09";
};
}