refactor: inputs/ --> {sys,home}/
This commit is contained in:
parent
8f22a24963
commit
f77c627980
225 changed files with 77 additions and 88 deletions
27
home/modules/console/editor/default.nix
Normal file
27
home/modules/console/editor/default.nix
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
{ lib, ... }:
|
||||
{
|
||||
|
||||
imports = [
|
||||
./helix
|
||||
# ./nvim
|
||||
];
|
||||
|
||||
options.homeModules.console.editor = {
|
||||
helix = {
|
||||
enable = lib.mkEnableOption "Enable helix text editor";
|
||||
default = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
description = "Set helix as the default text editor in environment variables";
|
||||
};
|
||||
};
|
||||
nvim = {
|
||||
enable = lib.mkEnableOption "Enable nvim text editor";
|
||||
default = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
description = "Set nvim as the default text editor in environment variables";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
68
home/modules/console/editor/helix/default.nix
Normal file
68
home/modules/console/editor/helix/default.nix
Normal 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; };
|
||||
};
|
||||
};
|
||||
}
|
||||
142
home/modules/console/editor/helix/languages.nix
Normal file
142
home/modules/console/editor/helix/languages.nix
Normal 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;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
73
home/modules/console/editor/helix/theme.nix
Normal file
73
home/modules/console/editor/helix/theme.nix
Normal 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";
|
||||
};
|
||||
}
|
||||
57
home/modules/console/editor/nvim/default.nix
Normal file
57
home/modules/console/editor/nvim/default.nix
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
{ config, lib, inputs, pkgs, ... }:
|
||||
|
||||
let
|
||||
inherit (config.colorscheme) palette;
|
||||
cfg = config.homeModules.console.editor.nvim;
|
||||
in
|
||||
|
||||
{
|
||||
imports = [
|
||||
inputs.nixvim.homeManagerModules.nixvim
|
||||
./settings.nix
|
||||
./keymapping.nix
|
||||
./plugins
|
||||
];
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
programs.neovim = {
|
||||
viAlias = true;
|
||||
vimAlias = true;
|
||||
};
|
||||
|
||||
programs.nixvim = {
|
||||
enable = true;
|
||||
plugins = {
|
||||
which-key = {
|
||||
enable = true;
|
||||
keyLabels = {
|
||||
" " = "<space>";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
colorschemes.base16 = {
|
||||
enable = true;
|
||||
colorscheme = config.colorscheme.slug;
|
||||
customColorScheme = {
|
||||
base00 = "#${palette.base00}";
|
||||
base01 = "#${palette.base01}";
|
||||
base02 = "#${palette.base02}";
|
||||
base03 = "#${palette.base03}";
|
||||
base04 = "#${palette.base04}";
|
||||
base05 = "#${palette.base05}";
|
||||
base06 = "#${palette.base06}";
|
||||
base07 = "#${palette.base07}";
|
||||
base08 = "#${palette.base08}";
|
||||
base09 = "#${palette.base09}";
|
||||
base0A = "#${palette.base0A}";
|
||||
base0B = "#${palette.base0B}";
|
||||
base0C = "#${palette.base0C}";
|
||||
base0D = "#${palette.base0D}";
|
||||
base0E = "#${palette.base0E}";
|
||||
base0F = "#${palette.base0F}";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
50
home/modules/console/editor/nvim/keymapping.nix
Normal file
50
home/modules/console/editor/nvim/keymapping.nix
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
{ config, lib, ... }:
|
||||
|
||||
let
|
||||
cfg = config.homeModules.console.editor.nvim;
|
||||
in
|
||||
|
||||
{
|
||||
config = lib.mkIf cfg.enable {
|
||||
programs.nixvim = {
|
||||
globals = {
|
||||
mapleader = " ";
|
||||
maplocalleader = " ";
|
||||
};
|
||||
|
||||
keymaps = let
|
||||
normal =
|
||||
lib.mapAttrsToList
|
||||
(key: action: {
|
||||
mode = "n";
|
||||
inherit action key;
|
||||
})
|
||||
{
|
||||
"<Space>" = "<NOP>";
|
||||
"esc" = ":noh<CR>";
|
||||
"Y" = "$y";
|
||||
};
|
||||
visual =
|
||||
lib.mapAttrsToList
|
||||
(key: action: {
|
||||
mode = "v";
|
||||
inherit action key;
|
||||
})
|
||||
{
|
||||
# better indenting
|
||||
">" = ">gv";
|
||||
"<" = "<gv";
|
||||
"<TAB>" = ">gv";
|
||||
"<S-TAB>" = "<gv";
|
||||
|
||||
# move selected line / block of text in visual mode
|
||||
"K" = ":m '<-2<CR>gv=gv";
|
||||
"J" = ":m '>+1<CR>gv=gv";
|
||||
};
|
||||
in
|
||||
config.nixvim.helpers.keymaps.mkKeymaps
|
||||
{options.silent = true;}
|
||||
(normal ++ visual);
|
||||
};
|
||||
};
|
||||
}
|
||||
28
home/modules/console/editor/nvim/plugins/default.nix
Normal file
28
home/modules/console/editor/nvim/plugins/default.nix
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
{ lib, ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
./indent.nix
|
||||
./telescope.nix
|
||||
./lualine.nix
|
||||
];
|
||||
|
||||
options.homeModules.console.editor.nvim.plugins = {
|
||||
indentBlankline = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
description = "Enable indent-blankline nvim plugin module";
|
||||
};
|
||||
lualine = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
description = "Enable lualine nvim plugin module";
|
||||
};
|
||||
telescope = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
description = "Enable telescope nvim plugin module";
|
||||
};
|
||||
};
|
||||
|
||||
}
|
||||
13
home/modules/console/editor/nvim/plugins/indent.nix
Normal file
13
home/modules/console/editor/nvim/plugins/indent.nix
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
{ config, lib, ... }:
|
||||
|
||||
let
|
||||
cfg = config.homeModules.console.editor.nvim.plugins;
|
||||
in
|
||||
|
||||
{
|
||||
config = lib.mkIf cfg.indentBlankline {
|
||||
programs.nixvim.plugins.indent-blankline = {
|
||||
enable = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
23
home/modules/console/editor/nvim/plugins/lualine.nix
Normal file
23
home/modules/console/editor/nvim/plugins/lualine.nix
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
{ config, lib, ... }:
|
||||
|
||||
let
|
||||
cfg = config.homeModules.console.editor.nvim.plugins;
|
||||
in
|
||||
|
||||
{
|
||||
config = lib.mkIf cfg.lualine {
|
||||
programs.nixvim.plugins.lualine = {
|
||||
enable = true;
|
||||
theme = "base16";
|
||||
globalstatus = true;
|
||||
sections = {
|
||||
lualine_a = ["mode"];
|
||||
lualine_b = ["branch"];
|
||||
lualine_c = ["filename" "diff"];
|
||||
lualine_x = ["diagnostics"];
|
||||
lualine_y = ["fileformat"];
|
||||
lualine_z = ["filetype"];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
41
home/modules/console/editor/nvim/plugins/telescope.nix
Normal file
41
home/modules/console/editor/nvim/plugins/telescope.nix
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
{ config, lib, ... }:
|
||||
|
||||
let
|
||||
cfg = config.homeModules.console.editor.nvim.plugins;
|
||||
in
|
||||
|
||||
{
|
||||
config = lib.mkIf cfg.telescope {
|
||||
programs.nixvim = {
|
||||
plugins.telescope = {
|
||||
enable = true;
|
||||
extensions = {
|
||||
fzf-native.enable = true;
|
||||
frecency.enable = true;
|
||||
};
|
||||
|
||||
keymaps = {
|
||||
"<leader>ff" = "find_files";
|
||||
"<leader>fg" = "live_grep";
|
||||
"<leader>b" = "buffers";
|
||||
"<leader>fh" = "help_tags";
|
||||
"<leader>fd" = "diagnostics";
|
||||
|
||||
"<C-p>" = "git_files";
|
||||
"<leader>p" = "oldfiles";
|
||||
"<C-f>" = "live_grep";
|
||||
};
|
||||
|
||||
keymapsSilent = true;
|
||||
|
||||
defaults = {
|
||||
file_ignore_patterns = [
|
||||
"^.git/"
|
||||
"^data/"
|
||||
];
|
||||
set_env.COLORTERM = "truecolor";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
60
home/modules/console/editor/nvim/settings.nix
Normal file
60
home/modules/console/editor/nvim/settings.nix
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
{ config, lib, ... }:
|
||||
|
||||
let
|
||||
inherit (config.colorscheme) palette;
|
||||
cfg = config.homeModules.console.editor.nvim;
|
||||
in
|
||||
|
||||
{
|
||||
config = lib.mkIf cfg.enable {
|
||||
programs.nixvim = {
|
||||
options = {
|
||||
relativenumber = true;
|
||||
number = true;
|
||||
hidden = true;
|
||||
mouse = "a";
|
||||
mousemodel = "extend";
|
||||
undofile = true;
|
||||
swapfile = false;
|
||||
incsearch = true;
|
||||
ignorecase = true;
|
||||
smartcase = true;
|
||||
fileencoding = "utf-8";
|
||||
termguicolors = true;
|
||||
autoindent = true;
|
||||
shiftwidth = 2;
|
||||
smartindent = true;
|
||||
expandtab = true;
|
||||
updatetime = 100;
|
||||
};
|
||||
|
||||
clipboard = {
|
||||
register = "unnamedplus";
|
||||
providers.wl-copy.enable = true;
|
||||
};
|
||||
|
||||
colorschemes.base16 = {
|
||||
enable = true;
|
||||
colorscheme = config.colorscheme.slug;
|
||||
customColorScheme = {
|
||||
base00 = "#${palette.base00}";
|
||||
base01 = "#${palette.base01}";
|
||||
base02 = "#${palette.base02}";
|
||||
base03 = "#${palette.base03}";
|
||||
base04 = "#${palette.base04}";
|
||||
base05 = "#${palette.base05}";
|
||||
base06 = "#${palette.base06}";
|
||||
base07 = "#${palette.base07}";
|
||||
base08 = "#${palette.base08}";
|
||||
base09 = "#${palette.base09}";
|
||||
base0A = "#${palette.base0A}";
|
||||
base0B = "#${palette.base0B}";
|
||||
base0C = "#${palette.base0C}";
|
||||
base0D = "#${palette.base0D}";
|
||||
base0E = "#${palette.base0E}";
|
||||
base0F = "#${palette.base0F}";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue