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,10 @@
{
imports = [
./editor # Still need to implement nvim
./fileManager
./multiplexer # Still need to implement tmux and screen
./prompt # only Starship is currently implemented
./shell
./utility
];
}

View 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";
};
};
};
}

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";
};
}

View 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}";
};
};
};
};
}

View 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);
};
};
}

View 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";
};
};
}

View 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;
};
};
}

View 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"];
};
};
};
}

View 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";
};
};
};
};
}

View 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}";
};
};
};
};
}

View file

@ -0,0 +1,28 @@
{ lib, ... }:
{
imports = [
./lf #configuration still needs some work
# ./ranger
];
options.homeModules.console.fileManager = {
lf = {
enable = lib.mkEnableOption "Enable lf file manager";
default = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Set lf as the default terminal file manager";
};
};
ranger = {
enable = lib.mkEnableOption "Enable ranger file manager";
default = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Set ranger as the default terminal file manager";
};
};
};
}

View file

@ -0,0 +1,65 @@
{ pkgs, lib, config, ... }:
#TODO - mkif wayland for previewer
# - manage previewer dependencies better
# - ripdrag support
# - color parity with eza
let
cfg = config.homeModules.console.fileManager.lf;
in
{
config = lib.mkIf cfg.enable {
home.sessionVariables.FILEMANAGER = lib.mkIf cfg.default "lf";
xdg.configFile."lf/icons".source = ./icons;
programs.lf = {
enable = true;
settings = {
hidden = true;
ignorecase = true;
drawbox = true;
icons = true;
};
previewer = {
keybinding = "i";
source = "${pkgs.ctpv}/bin/ctpv";
};
commands = {
fzf-lf = ''
''${{
res="$(find -L . \( -path '*/\.*' -o -fstype 'dev' -o -fstype 'proc' \) -prune -o -print 2> /dev/null | sed 1d | cut -b3- | fzf +m)"
if [ -d "$res" ] ; then
cmd="cd"
elif [ -f "$res" ] ; then
cmd="select"
else
exit 0
fi
lf -remote "send $id $cmd \"$res\""
}}
'';
mkdir = ''
''${{
printf "Directory Name: "
read DIR
mkdir $DIR
}}
'';
};
keybindings = {
c = "mkdir";
"<a-f>" = "fzf-lf";
};
extraConfig = ''
&${pkgs.ctpv}/bin/ctpv -s $id
cmd on-quit %${pkgs.ctpv}/bin/ctpv -e $id
set cleaner ${pkgs.ctpv}/bin/ctpvclear
set sixel true
'';
};
home.packages = with pkgs; [ chafa ctpv glow ];
};
}

View file

@ -0,0 +1,17 @@
{ lib, config, ... }:
{
imports = [
./zellij
#./screen
./tmux
];
options.homeModules.console.multiplexer = {
zellij = {
enable = lib.mkEnableOption "Enable zellij multiplexer";
};
tmux = {
enable = lib.mkEnableOption "Enable tmux multiplexer";
};
};
}

View file

@ -0,0 +1,58 @@
{ config, lib, pkgs, ... }:
let
cfg = config.homeModules.console.multiplexer.tmux;
inherit (config.colorscheme) palette;
in
{
config = lib.mkIf cfg.enable {
programs.tmux = {
enable = true;
shell = "${pkgs.fish}/bin/fish";
prefix = "C-space";
baseIndex = 1;
keyMode = "vi";
escapeTime = 0;
mouse = true;
plugins = with pkgs; [
{
plugin = tmuxPlugins.mode-indicator;
}
];
extraConfig = /* sh */ ''
# General Settings
set -g set-clipboard on
#Appearance
set -g status-position top
set -g status-style "fg=#${palette.base05} bg=#${palette.base00}"
#Windows
set -g status-justify "centre"
setw -g window-status-current-format "#[bg=#${palette.base0B},fg=#${palette.base00},bold] #W "
setw -g window-status-format "#[bg=#${palette.base03},fg=#${palette.base05}] #W "
#Left
set -g status-left " #{tmux_mode_indicator} #[bg=#${palette.base0B},fg=#${palette.base00}] #S"
set -g status-right '%Y-%m-%d %H:%M #{tmux_mode_indicator}'
#Move to Pane
bind -n M-Left select-pane -L
bind -n M-h select-pane -L
bind -n M-Right select-pane -R
bind -n M-l select-pane -R
bind -n M-Up select-pane -U
bind -n M-k select-pane -U
bind -n M-Down select-pane -D
bind -n M-j select-pane -D
#Split Pane
bind -n M-- split-window -h
bind -n M-= split-window -v
#Resize Pane
bind -n C-M-Up resize-pane -U 5
bind -n C-M-Down resize-pane -D 5
bind -n C-M-Left resize-pane -L 5
bind -n C-M-Right resize-pane -R 5
#Move to Window
bind -n M-1
'';
};
};
}

View file

@ -0,0 +1,60 @@
{ lib, config, pkgs, ... }:
let
inherit (config.colorscheme) palette;
cfg = config.homeModules.console.multiplexer.zellij;
in
{
config = lib.mkIf cfg.enable {
programs.zellij = {
enable = true;
settings = {
theme = "${config.colorscheme.slug}";
default_shell = "fish";
default_layout = "default";
pane_frames = false;
themes = {
"${config.colorscheme.slug}" = {
fg = "#${palette.base05}";
bg = "#${palette.base00}";
black = "#${palette.base00}";
red = "#${palette.base08}";
green = "#${palette.base0B}";
yellow = "#${palette.base0A}";
blue = "#${palette.base0D}";
magenta = "#${palette.base0E}";
cyan = "#${palette.base0C}";
white = "#${palette.base05}";
orange = "#${palette.base09}";
};
};
};
};
# Layouts
# Default layout
xdg.configFile."zellij/layouts/default.kdl" = import ./layouts/defaultLayout.nix { inherit pkgs config; };
# Layout for bash scripts
xdg.configFile."zellij/layouts/script.kdl" = import ./layouts/scriptLayout.nix { inherit pkgs config; };
# Layout for configuring my flake
xdg.configFile."zellij/layouts/flake.kdl" = import ./layouts/flakeLayout.nix { inherit pkgs config; };
# Additional keybinds
xdg.configFile."zellij/config.kdl".text = /* kdl */ ''
keybinds {
shared_except "locked" {
bind "Alt 1" { GoToTab 1; }
bind "Alt 2" { GoToTab 2; }
bind "Alt 3" { GoToTab 3; }
bind "Alt 4" { GoToTab 4; }
bind "Alt 5" { GoToTab 5; }
bind "Alt 6" { GoToTab 6; }
bind "Alt 7" { GoToTab 7; }
bind "Alt 8" { GoToTab 8; }
bind "Alt 9" { GoToTab 9; }
}
}
'';
};
}

View file

@ -0,0 +1,60 @@
{ pkgs, config, ... }:
let
inherit (config.colorscheme) palette;
in
{
text = /* kdl */ ''
layout {
default_tab_template {
pane size=2 borderless=true {
plugin location="file:${pkgs.zjstatus}/bin/zjstatus.wasm" {
format_left "{mode}"
format_right "{session} {command_git_branch} {datetime}"
format_center "#[fg=#${palette.base0D},bold] {tabs}"
format_space ""
border_enabled "true"
border_char ""
border_format "#[fg=#${palette.base05}]{char}"
border_position "bottom"
hide_frame_for_single_pane "true"
mode_normal "#[fg=#${palette.base0D}] "
mode_tmux "#[fg=#${palette.base0E}] "
mode_pane "#[fg=#${palette.base08}] "
mode_tab "#[fg=#${palette.base08}] "
mode_rename_tab "#[fg=#${palette.base08}] "
mode_rename_pane "#[fg=#${palette.base08}] "
mode_session "#[fg=#${palette.base08}] "
mode_locked "#[fg=#${palette.base05}] "
mode_move "#[fg=#${palette.base0B}] "
mode_resize "#[fg=#${palette.base0B}] "
mode_prompt "#[fg=#${palette.base0A}] "
mode_search "#[fg=#${palette.base0A}] "
mode_enter_search "#[fg=#${palette.base0A}] "
tab_normal "#[bg=#${palette.base01}] {name} "
tab_active "#[bg=#${palette.base02}] {name} "
tab_separator " "
command_git_branch_command "git rev-parse --abbrev-ref HEAD"
command_git_branch_format "#[fg=#${palette.base0C}] {stdout} "
command_git_branch_interval "10"
command_git_branch_rendermode "static"
datetime "#[fg=#${palette.base05},bold] {format} "
datetime_format "%I:%M %p"
datetime_timezone "${config.home.sessionVariables.TZ}"
}
}
children
}
tab name="terminal" focus=true {
pane name="term" focus=true
}
}
'';
}

View file

@ -0,0 +1,66 @@
{ pkgs, config, ... }:
let
inherit (config.colorscheme) palette;
in
{
text = /* kdl */ ''
layout {
default_tab_template {
pane size=2 borderless=true {
plugin location="file:${pkgs.zjstatus}/bin/zjstatus.wasm" {
format_left "{mode}"
format_right "{session} {command_git_branch} {datetime}"
format_center "#[fg=#${palette.base0D},bold] {tabs}"
format_space ""
border_enabled "true"
border_char ""
border_format "#[fg=#${palette.base05}]{char}"
border_position "bottom"
hide_frame_for_single_pane "true"
mode_normal "#[fg=#${palette.base0D}] "
mode_tmux "#[fg=#${palette.base0E}] "
mode_pane "#[fg=#${palette.base08}] "
mode_tab "#[fg=#${palette.base08}] "
mode_rename_tab "#[fg=#${palette.base08}] "
mode_rename_pane "#[fg=#${palette.base08}] "
mode_session "#[fg=#${palette.base08}] "
mode_locked "#[fg=#${palette.base05}] "
mode_move "#[fg=#${palette.base0B}] "
mode_resize "#[fg=#${palette.base0B}] "
mode_prompt "#[fg=#${palette.base0A}] "
mode_search "#[fg=#${palette.base0A}] "
mode_enter_search "#[fg=#${palette.base0A}] "
tab_normal "#[bg=#${palette.base01}] {name} "
tab_active "#[bg=#${palette.base02}] {name} "
tab_separator " "
command_git_branch_command "git rev-parse --abbrev-ref HEAD"
command_git_branch_format "#[fg=#${palette.base0C}] {stdout} "
command_git_branch_interval "10"
command_git_branch_rendermode "static"
datetime "#[fg=#${palette.base05},bold] {format} "
datetime_format "%I:%M %p"
datetime_timezone "${config.home.sessionVariables.TZ}"
}
}
children
}
tab name="terminal" focus=true {
pane name="term" cwd="$FLAKE" focus=true
}
tab name="editor" {
pane name="edit" edit="$FLAKE"
}
tab name="git" {
pane name="git" cwd="$FLAKE" command="lazygit"
}
}
'';
}

View file

@ -0,0 +1,64 @@
{ pkgs, config, ... }:
let
inherit (config.colorscheme) palette;
in
{
text = /* kdl */ ''
layout {
default_tab_template {
pane size=2 borderless=true {
plugin location="file:${pkgs.zjstatus}/bin/zjstatus.wasm" {
format_left "{mode}"
format_right "{session} {command_git_branch} {datetime}"
format_center "#[fg=#${palette.base0D},bold] {tabs}"
format_space ""
border_enabled "true"
border_char ""
border_format "#[fg=#${palette.base05}]{char}"
border_position "bottom"
hide_frame_for_single_pane "true"
mode_normal "#[fg=#${palette.base0D}] "
mode_tmux "#[fg=#${palette.base0E}] "
mode_pane "#[fg=#${palette.base08}] "
mode_tab "#[fg=#${palette.base08}] "
mode_rename_tab "#[fg=#${palette.base08}] "
mode_rename_pane "#[fg=#${palette.base08}] "
mode_session "#[fg=#${palette.base08}] "
mode_locked "#[fg=#${palette.base05}] "
mode_move "#[fg=#${palette.base0B}] "
mode_resize "#[fg=#${palette.base0B}] "
mode_prompt "#[fg=#${palette.base0A}] "
mode_search "#[fg=#${palette.base0A}] "
mode_enter_search "#[fg=#${palette.base0A}] "
tab_normal "#[bg=#${palette.base01}] {name} "
tab_active "#[bg=#${palette.base02}] {name} "
tab_separator " "
command_git_branch_command "git rev-parse --abbrev-ref HEAD"
command_git_branch_format "#[fg=#${palette.base0C}] {stdout} "
command_git_branch_interval "10"
command_git_branch_rendermode "static"
datetime "#[fg=#${palette.base05},bold] {format} "
datetime_format "%I:%M %p"
datetime_timezone "${config.home.sessionVariables.TZ}"
}
}
children
}
tab name="edit" focus=true {
pane edit="./" name="edit" focus=true size="85%" borderless=true
pane name="term" focus=false size="15%" borderless=false
}
tab name="git" focus=false {
pane name="git" focus=false command="lazygit"
}
}
'';
}

View file

@ -0,0 +1,12 @@
{ lib, ... }:
{
imports = [
./starship
];
options.homeModules.console.prompt = {
starship = {
enable = lib.mkEnableOption "Enable starship prompt";
};
};
}

View file

@ -0,0 +1,110 @@
{ config, lib, ... }:
let
cfg = config.homeModules.console.prompt.starship;
in
{
config = lib.mkIf cfg.enable {
programs.starship = {
enable = true;
settings = {
format =
let
git = "$git_branch$git_commit$git_state$git_status";
cloud = "$aws$gcloud$openstack";
in
''
($nix_shell)$directory(${git})(- ${cloud})$jobs$character
'';
fill = {
symbol = " ";
disabled = false;
};
# Core
username = {
format = "[$user]($style)";
show_always = true;
};
hostname = {
format = "[@$hostname]($style) ";
ssh_only = false;
style = "bold green";
};
shlvl = {
format = "[$shlvl]($style) ";
style = "bold cyan";
threshold = 2;
repeat = true;
disabled = false;
};
cmd_duration = {
format = "took [$duration]($style) ";
};
directory = {
format = "[$path]($style)( [$read_only]($read_only_style)) ";
};
nix_shell = {
format = "[($name \\(develop\\) <- )$symbol]($style) ";
impure_msg = "";
symbol = " ";
style = "bold red";
};
character = {
error_symbol = "[](bold red)";
success_symbol = "[](bold green)";
vimcmd_symbol = "[](bold yellow)";
vimcmd_visual_symbol = "[](bold cyan)";
vimcmd_replace_symbol = "[](bold purple)";
vimcmd_replace_one_symbol = "[](bold purple)";
};
time = {
format = "\\\[[$time]($style)\\\]";
disabled = false;
};
# Cloud
gcloud = {
format = "on [$symbol$active(/$project)(\\($region\\))]($style)";
};
aws = {
format = "on [$symbol$profile(\\($region\\))]($style)";
};
# Icon changes only \/
aws.symbol = " ";
conda.symbol = " ";
dart.symbol = " ";
directory.read_only = " ";
docker_context.symbol = " ";
elixir.symbol = " ";
elm.symbol = " ";
gcloud.symbol = " ";
git_branch.symbol = " ";
golang.symbol = " ";
hg_branch.symbol = " ";
java.symbol = " ";
julia.symbol = " ";
memory_usage.symbol = "󰍛 ";
nim.symbol = "󰆥 ";
nodejs.symbol = " ";
package.symbol = "󰏗 ";
perl.symbol = " ";
php.symbol = " ";
python.symbol = " ";
ruby.symbol = " ";
rust.symbol = " ";
scala.symbol = " ";
shlvl.symbol = "";
swift.symbol = "󰛥 ";
terraform.symbol = "󱁢";
};
};
};
}

View file

@ -0,0 +1,9 @@
{ config, lib, ... }:
let
cfg = config.homeModules.console.shell.bash;
in
{
config = lib.mkIf cfg.enable {
programs.bash.enable = true;
};
}

View file

@ -0,0 +1,17 @@
{ lib, ... }:
{
imports = [
./fish
./bash
./zsh
];
options.homeModules.console.shell = {
fish = {
enable = lib.mkEnableOption "Enable fish configuration";
};
bash = {
enable = lib.mkEnableOption "Enable bash configuration";
};
};
}

View file

@ -0,0 +1,80 @@
{ lib, config, ... }:
let
cfg = config.homeModules.console.shell.fish;
inherit (lib) mkIf;
hasPackage = pname: lib.any (p: p ? pname && p.pname == pname) config.home.packages;
hasEza = hasPackage "eza";
hasBat = hasPackage "bat";
in
{
config = {
programs.fish = mkIf cfg.enable {
enable = true;
shellAbbrs = {
fe = "cd $FLAKE; $EDITOR $FLAKE";
f = "cd $FLAKE";
s = "cd $SCRIPTS";
tree = mkIf hasEza "eza -T --icons --group-directories-first";
ls = mkIf hasEza "eza -a --icons --group-directories-first";
lsd = mkIf hasEza "eza -al --icons --group-directories-first";
lst = mkIf hasEza "eza -T -L 5 --icons --group-directories-first";
lsta = mkIf hasEza "eza -T --icons --group-directories-first";
cat = mkIf hasBat "bat";
};
functions = {
fish_greeting = "";
fish_flake_edit = ''
cd $FLAKE
hx $FLAKE
'';
fish_hello_world = ''
echo "Hello World"; string repeat -N \n --count=(math (count (fish_prompt)) - 1); commandline -f repaint
'';
fish_user_key_bindings = ''
bind --preset -M insert \cf fish_flake_edit
bind --preset -M insert \ec fzf_cd_widget
'';
};
interactiveShellInit =
# Use vim bindings and cursors
''
fish_vi_key_bindings
set fish_cursor_default block blink
set fish_cursor_insert line blink
set fish_cursor_replace_one underscore blink
set fish_cursor_visual block
'' +
# Use terminal colors
''
set -U fish_color_autosuggestion brblack
set -U fish_color_cancel -r
set -U fish_color_command brgreen
set -U fish_color_comment brmagenta
set -U fish_color_cwd green
set -U fish_color_cwd_root red
set -U fish_color_end brmagenta
set -U fish_color_error brred
set -U fish_color_escape brcyan
set -U fish_color_history_current --bold
set -U fish_color_host normal
set -U fish_color_match --background=brblue
set -U fish_color_normal normal
set -U fish_color_operator cyan
set -U fish_color_param brblue
set -U fish_color_quote yellow
set -U fish_color_redirection bryellow
set -U fish_color_search_match 'bryellow' '--background=brblack'
set -U fish_color_selection 'white' '--bold' '--background=brblack'
set -U fish_color_status red
set -U fish_color_user brgreen
set -U fish_color_valid_path --underline
set -U fish_pager_color_completion normal
set -U fish_pager_color_description yellow
set -U fish_pager_color_prefix 'white' '--bold' '--underline'
set -U fish_pager_color_progress 'brwhite' '--background=cyan'
'';
};
};
}

View file

@ -0,0 +1,18 @@
{ lib, config, ... }:
let
inherit (lib) mkIf mkEnableOption;
cfg = config.homeModules.console.shell.zsh;
in
{
options.homeModules.console.shell.zsh.enable = mkEnableOption "";
config = mkIf cfg.enable {
programs.zsh = {
enable = true;
autocd = true;
dotDir = ".config/zsh";
};
};
}

View file

@ -0,0 +1,24 @@
{ lib, ... }:
{
imports = [
./nixIndex
./git
./tools
./ssh
];
options.homeModules.console.utility = {
nixIndex = {
enable = lib.mkEnableOption "Enable nixIndex configuration";
};
git = {
enable = lib.mkEnableOption "Enable git + tools";
};
ssh = {
enable = lib.mkEnableOption "Enable various console ssh";
};
tools = {
enable = lib.mkEnableOption "Enable various console tools";
};
};
}

View file

@ -0,0 +1,24 @@
{ pkgs, config, lib, ... }:
let
cfg = config.homeModules.console.utility.git;
in
{
config = lib.mkIf cfg.enable {
programs.git = {
enable = true;
package = pkgs.gitAndTools.gitFull;
userName = "ooks-io";
userEmail = "ooks@protonmail.com";
extraConfig = {
gpg."ssh".program = "${pkgs._1password-gui}/bin/op-ssh-sign";
};
ignores = [ ".direnv" "result" ];
lfs.enable = true;
};
home.packages = with pkgs; [
lazygit
];
};
}

View file

@ -0,0 +1,38 @@
{ pkgs, config, lib, ... }:
let
cfg = config.homeModules.console.utility.nixIndex;
update-script = pkgs.writeShellApplication {
name = "fetch-nix-index-database";
runtimeInputs = with pkgs; [ wget coreutils ];
text = ''
filename="index-x86_64-linux"
mkdir -p ~/.cache/nix-index
cd ~/.cache/nix-index
wget -N "https://github.com/Mic92/nix-index-database/releases/latest/download/$filename"
ln -f "$filename" files
'';
};
in
{
config = lib.mkIf cfg.enable {
programs.nix-index.enable = true;
systemd.user.services.nix-index-database-sync = {
Unit = { Description = "fetch mic92/nix-index-database"; };
Service = {
Type = "oneshot";
ExecStart = "${update-script}/bin/fetch-nix-index-database";
Restart = "on-failure";
RestartSec = "5m";
};
};
systemd.user.timers.nix-index-database-sync = {
Unit = { Description = "Automatic github:mic92/nix-index-database fetching"; };
Timer = {
OnBootSec = "10m";
OnUnitActiveSec = "24h";
};
Install = { WantedBy = [ "timers.target" ]; };
};
};
}

View file

@ -0,0 +1,24 @@
{ lib, config, ... }:
let
cfg = config.homeModules.console.utility.ssh;
hasFish = mkIf config.homeModules.console.shell.fish.enable;
inherit (lib) mkIf;
in
{
config = mkIf cfg.enable {
programs.ssh = {
enable = true;
extraConfig = /* config */''
Host *
IdentityAgent "~/.1password/agent.sock"
'';
};
programs.fish.interactiveShellInit = hasFish ''
set -gx SSH_AUTH_SOCK ~/.1password/agent.sock
'';
};
}

View file

@ -0,0 +1,77 @@
{ pkgs, lib, config, ... }:
let
cfg = config.homeModules.console.utility.tools;
in
{
config = lib.mkIf cfg.enable {
home.packages = with pkgs; [
bc # Calculator
# file utility
duf
du-dust
fd
ripgrep
# archive
zip
unzip
unrar
# file transfer
wget
httpie # Better curl
# resource manager
powertop
#shell scripting
gum
# audio ctrl
pamixer
diffsitter # Better diff
jq # JSON pretty printer and manipulator
comma # Install and run with ","
tldr # Community maintained help pages
progress
killall
acpi
# Notifications
libnotify
# Nix tooling
alejandra
];
programs = {
btop.enable = true;
eza.enable = true;
bat = {
enable = true;
config = {
theme = "base16";
pager = "less -FR";
};
};
direnv = {
enable = true;
nix-direnv.enable = true;
};
fzf = {
enable = true;
enableFishIntegration = lib.mkIf config.homeModules.console.shell.fish.enable true;
defaultCommand = "rg --files --hidden";
changeDirWidgetOptions = [
"--preview 'eza --icons -L 3 -T --color always {} | head -200'"
"--exact"
];
fileWidgetCommand = "rg --files";
fileWidgetOptions = [
"--preview 'bat --color=always {}'"
];
};
};
};
}