This commit is contained in:
unexplrd
2025-02-06 00:33:06 +02:00
commit 2e6e28ef32
254 changed files with 28562 additions and 0 deletions

View File

@ -0,0 +1,23 @@
{
# config,
pkgs,
...
}: {
home.packages = with pkgs; [
git
ripgrep
trashy
fd
dust
procs
eza
tree
speedtest-rs
zip
unzip
execline
fastfetch
alejandra
uutils-coreutils-noprefix
];
}

View File

@ -0,0 +1,88 @@
{
pkgs,
config,
lib,
...
}:
with lib; let
cfg = config.console.yazi;
in {
options = {
console.yazi.enable =
mkEnableOption "enable yazi file manager";
};
config = mkIf cfg.enable {
programs.yazi = {
enable = true;
enableNushellIntegration = true;
settings = {
opener = {
open = [
{
run = "xdg-open \"$@\"";
orphan = true;
desc = "Open";
}
];
edit = [
{
run = "$EDITOR \"$@\"";
block = true;
desc = "Edit";
}
];
dragdrop = [
{
run = "${pkgs.ripdrag}/bin/ripdrag \"$@\"";
desc = "Drag'n'drop";
orphan = true;
for = "unix";
}
];
};
open.rules = [
{
mime = "text/*";
use = ["edit" "open" "dragdrop"];
}
{
name = "*.toml";
use = ["edit" "open" "dragdrop"];
}
{
name = "*.c";
use = ["edit" "open" "dragdrop"];
}
{
name = "*.cpp";
use = ["edit" "open" "dragdrop"];
}
{
name = "*.rs";
use = ["edit" "open" "dragdrop"];
}
{
name = "*.py";
use = ["edit" "open" "dragdrop"];
}
{
name = "*.json";
use = ["edit" "open" "dragdrop"];
}
{
name = "*";
use = ["open" "edit" "dragdrop"];
}
];
};
keymap = {
manager.append_keymap = [
{
on = ["<C-n>"];
run = ''shell '${pkgs.ripdrag}/bin/ripdrag -x "$@"' --confirm'';
}
];
};
};
};
}

View File

@ -0,0 +1,122 @@
{
pkgs,
config,
lib,
...
}:
with lib; let
cfg = config.editor.helix;
in {
options = {
editor.helix.enable =
mkEnableOption "enable helix editor";
};
config = mkIf cfg.enable {
programs.helix = {
enable = true;
defaultEditor = true;
settings = {
editor = {
line-number = "relative";
bufferline = "multiple";
cursorline = true;
lsp.display-messages = true;
cursor-shape = {
insert = "bar";
normal = "block";
select = "underline";
};
statusline = {
left = ["mode" "spinner" "version-control"];
center = ["file-name"];
right = ["diagnostics" "selections" "position" "file-encoding" "file-line-ending" "file-type"];
separator = "|";
};
soft-wrap = {
enable = true;
max-wrap = 25;
max-indent-retain = 0;
wrap-indicator = "";
};
};
keys.normal = {
space = {
space = "file_picker";
w = ":w";
q = ":q";
x = ":x";
n = ":n";
"," = "goto_previous_buffer";
"." = "goto_next_buffer";
l = ":reflow";
};
esc = ["collapse_selection" "keep_primary_selection"];
};
};
languages = {
language-server = {
clangd = {
command = "${pkgs.clang-tools}/bin/clangd";
};
rust-analyzer = {
command = "${pkgs.rust-analyzer}/bin/rust-analyzer";
};
texlab = {
command = "${pkgs.texlab}/bin/texlab";
};
nil = {
command = "${pkgs.nil}/bin/nil";
};
markdown-oxide = {
command = "${pkgs.markdown-oxide}/bin/markdown-oxide";
};
tinymist = {
command = lib.getExe pkgs.tinymist;
};
};
language = [
{
name = "nix";
auto-format = true;
formatter.command = "${pkgs.alejandra}/bin/alejandra";
language-servers = ["nil"];
}
{
name = "latex";
auto-format = true;
formatter.command = "${pkgs.texlivePackages.latexindent}/bin/latexindent";
language-servers = ["texlab"];
}
{
name = "typst";
auto-format = true;
formatter.command = lib.getExe pkgs.typstyle;
language-servers = ["tinymist"];
}
{
name = "markdown";
auto-format = true;
formatter.command = "${pkgs.comrak}/bin/comrak";
language-servers = ["markdown-oxide"];
}
{
name = "c";
auto-format = true;
formatter.command = "${pkgs.clang-tools}/bin/clang-format";
}
{
name = "cpp";
auto-format = true;
formatter.command = "${pkgs.clang-tools}/bin/clang-format";
}
{
name = "rust";
auto-format = true;
language-servers = ["rust-analyzer"];
formatter.command = "${pkgs.rustfmt}/bin/rustfmt";
}
];
};
};
};
}

View File

@ -0,0 +1,8 @@
{
imports = [
./helix.nix
./zed.nix
./neve.nix
#./nixvim.nix
];
}

View File

@ -0,0 +1,28 @@
{
pkgs,
lib,
inputs,
config,
...
}:
with lib; let
cfg = config.editor.neve;
in {
options = {
editor.neve.enable =
mkEnableOption "enable neve neovim distribution";
};
config = mkIf cfg.enable {
home.packages = with pkgs; [
neovide
cpplint
statix
];
programs.nixvim = {
enable = true;
imports = [inputs.neve.nixvimModule];
viAlias = true;
vimAlias = true;
};
};
}

View File

@ -0,0 +1,270 @@
{
pkgs,
pkgs-51b85c,
lib,
config,
...
}: {
options = {
editor.neovim.enable =
lib.mkEnableOption "enable neovim text editor";
};
config = lib.mkIf config.editors.neovim.enable {
# stylix.targets.nixvim.enable = true;
home.packages = with pkgs; [neovide];
programs.nixvim = {
enable = true;
enableMan = true;
# package = ;
plugins.lualine.enable = true;
plugins.treesitter = {
enable = true;
folding = true;
};
plugins = {
yazi.enable = true;
noice = {
enable = true;
popupmenu.backend = "nui";
};
notify.enable = true;
telescope.enable = true;
transparent.enable = true;
lsp-format.enable = true;
lsp-lines.enable = true;
lsp-status.enable = true;
which-key.enable = true;
web-devicons.enable = true;
# vimtex = {
# enable = true;
# texlivePackage = pkgs.tectonic; #pkgs.texlive.combined.scheme-full;
# settings = {
# compiler_method = "tectonic";
# view_method = "zathura_simple";
# compiler_tectonic = {
# "aux_dir" = {};
# "out_dir" = {};
# "callback" = 1;
# "continuous" = 0;
# "executable" = "latexmk";
# "hooks" = {};
# "options" = [
# "--synctex"
# "--keep-logs"
# "-Z shell-escape"
# "-Z continue-on-errors"
# ];
# };
# compiler_latexmk = {
# "aux_dir" = {};
# "out_dir" = {};
# "callback" = 1;
# "continuous" = 0;
# "executable" = "latexmk";
# "hooks" = {};
# "options" = [
# "-xelatex"
# "-recorder"
# "-file-line-error"
# "-synctex=1"
# "-interaction=nonstopmode"
# "-shell-escape"
# ];
# };
# };
# };
treesitter-textobjects.enable = true;
cmp-latex-symbols.enable = true;
dap.enable = true;
rustaceanvim.enable = true;
lsp = {
enable = true;
servers = {
clangd.enable = true;
#rust_analyzer = {
# enable = true;
# installRustc = true;
# installCargo = true;
#};
lua_ls.enable = true;
nil_ls.enable = true;
};
};
};
plugins = {
cmp-nvim-lsp = {enable = true;}; # lsp
cmp-buffer = {enable = true;};
cmp-path = {enable = true;}; # file system paths
cmp_luasnip = {enable = true;}; # snippets
cmp-cmdline = {enable = true;}; # autocomplete for cmdline
cmp = {
enable = true;
autoEnableSources = true;
settings = {
sources = [
{name = "nvim_lsp";}
{name = "path";}
{name = "buffer";}
];
mapping = {
"<C-Space>" = "cmp.mapping.complete()";
"<C-d>" = "cmp.mapping.scroll_docs(-4)";
"<C-e>" = "cmp.mapping.close()";
"<C-f>" = "cmp.mapping.scroll_docs(4)";
"<CR>" = "cmp.mapping.confirm({ select = true })";
"<S-Tab>" = "cmp.mapping(cmp.mapping.select_prev_item(), {'i', 's'})";
"<Tab>" = "cmp.mapping(cmp.mapping.select_next_item(), {'i', 's'})";
};
experimental = {
ghost_text = true;
};
};
};
luasnip = {
enable = true;
settings = {
enable_autosnippets = true;
store_selection_keys = "<Tab>";
};
};
};
clipboard = {
providers.wl-copy.enable = true;
};
globals.mapleader = " ";
globals.maplocalleader = ",";
opts = {
# Show line numbers
number = true;
# Show relative line numbers
relativenumber = true;
# Use the system clipboard
clipboard = "unnamedplus";
# Number of spaces that represent a <TAB>
tabstop = 2;
softtabstop = 2;
# Show tabline always
showtabline = 2;
# Use spaces instead of tabs
expandtab = true;
# Enable smart indentation
smartindent = true;
# Number of spaces to use for each step of (auto)indent
shiftwidth = 2;
# Enable break indent
breakindent = true;
# Highlight the screen line of the cursor
cursorline = true;
# Minimum number of screen lines to keep above and below the cursor
scrolloff = 8;
# Enable mouse support
mouse = "a";
# Set folding method to manual
foldmethod = "manual";
# Disable folding by default
foldenable = false;
# Wrap long lines at a character in 'breakat'
linebreak = true;
# Disable spell checking
spell = false;
# Disable swap file creation
swapfile = false;
# Time in milliseconds to wait for a mapped sequence to complete
timeoutlen = 300;
# Enable 24-bit RGB color in the TUI
termguicolors = true;
# Don't show mode in the command line
showmode = false;
# Open new split below the current window
splitbelow = true;
# Keep the screen when splitting
splitkeep = "screen";
# Open new split to the right of the current window
splitright = true;
# Hide command line unless needed
cmdheight = 0;
# Remove EOB
fillchars = {
eob = " ";
};
};
keymaps = [
{
mode = "n";
key = "j";
action = "gj";
}
{
mode = "n";
key = "k";
action = "gk";
}
{
mode = "n";
key = "n";
action = "nzzzv";
}
{
mode = "n";
key = "N";
action = "Nzzzv";
}
{
mode = "n";
key = "<C-d>";
action = "<C-d>zz";
}
{
mode = "n";
key = "<C-u>";
action = "<C-u>zz";
}
{
mode = "n";
key = "<leader>yy";
action = "<cmd>Yazi<cr>";
options = {desc = "open yazi";};
}
{
mode = "n";
key = "<leader>fo";
action = "<cmd>Telescope oldfiles<cr>";
options = {desc = "Telescope oldfiles";};
}
{
mode = "n";
key = "<leader>ff";
action = "<cmd>Telescope find_files<cr>";
options = {desc = "Telescope find files";};
}
];
};
};
}

View File

@ -0,0 +1,114 @@
{
config,
pkgs,
lib,
...
}:
with lib; let
cfg = config.editor.zed;
in {
options = {
editor.zed.enable =
mkEnableOption "enable zed editor";
};
config = mkIf cfg.enable {
programs.zed-editor = {
enable = true;
extensions = [
"nix"
"latex"
"typst"
];
userSettings = {
vim_mode = true;
ui_font_size = lib.mkForce 16;
buffer_font_size = lib.mkForce 16;
features = {inline_completion_provider = "none";};
auto_update = false;
languages = {
"Nix" = {
language-servers = [
"nil"
"!nixd"
];
formatter = {
external.command = lib.getExe pkgs.alejandra;
};
};
"Rust" = {
formatter = {
external = {
command = lib.getExe pkgs.rustfmt;
arguments = ["--edition" "2021"];
};
};
};
"typst" = {
language-servers = ["tinymist"];
format_on_save = "on";
formatter = {
external = {
command = lib.getExe pkgs.typstyle;
arguments = ["-i" "{buffer_path}"];
};
};
};
"Python" = {
format_on_save = "on";
formatter = [
{
language_server = {
name = "ruff";
};
}
];
language_servers = ["ruff"];
};
};
lsp = {
clangd = {
binary = {
arguments = [];
path = "${pkgs.clang-tools}/bin/clangd";
};
};
rust-analyzer = {
binary = {
arguments = [];
path = lib.getExe pkgs.rust-analyzer;
};
};
ruff = {
binary = {
arguments = [];
path = lib.getExe pkgs.ruff;
};
};
nil = {
binary = {
arguments = [];
path = lib.getExe pkgs.nil;
};
initialization_options.formatting.command = [(lib.getExe pkgs.alejandra)];
};
texlab = {
binary = {
arguments = [];
path = lib.getExe pkgs.texlab;
};
};
tinymist = {
binary = {
arguments = [];
path = lib.getExe pkgs.tinymist;
};
};
};
telemetry = {
diagnostics = false;
metrics = false;
};
};
};
};
}

View File

@ -0,0 +1,107 @@
{
services.flatpak = {
enable = true;
remotes = [
{
name = "flathub";
location = "https://dl.flathub.org/repo/flathub.flatpakrepo";
}
{
name = "hero-persson";
location = "https://hero-persson.github.io/unmojang-flatpak/index.flatpakrepo";
}
];
packages = [
# misc
"io.github.zen_browser.zen"
"net.mullvad.MullvadBrowser"
"com.obsproject.Studio"
"com.bitwarden.desktop"
"com.github.tchx84.Flatseal"
"org.qbittorrent.qBittorrent"
# "com.transmissionbt.Transmission"
"com.usebottles.bottles"
"com.logseq.Logseq"
"io.github.martchus.syncthingtray"
# chatting
"org.signal.Signal"
"im.riot.Riot"
"org.telegram.desktop"
"io.github.spacingbat3.webcord"
"org.mozilla.Thunderbird"
# media
"org.atheme.audacious"
"io.freetubeapp.FreeTube"
#"io.github.celluloid_player.Celluloid"
# "io.mpv.Mpv"
# gaming
#"com.github._0negal.Viper"
"net.lutris.Lutris"
"com.heroicgameslauncher.hgl"
{
appId = "org.unmojang.FjordLauncher";
origin = "hero-persson";
}
"org.freedesktop.Platform.VulkanLayer.MangoHud//24.08"
"org.freedesktop.Platform.VulkanLayer.gamescope//24.08"
];
overrides = {
"global" = {
# Force Wayland by default
Context = {
sockets = ["wayland" "!x11" "!fallback-x11"];
filesystems = [
"xdg-run/pipewire-0"
"xdg-config/gtk-3.0:ro"
"xdg-config/gtk-4.0:ro"
# "~/.local/share/fonts:ro"
"~/.local/share/icons:ro"
# "~/.nix-profile/share/icons:ro"
# "~/.nix-profile/share/fonts:ro"
"/nix/store:ro"
];
};
Environment = {
XCURSOR_PATH = "/run/host/user-share/icons:/run/host/share/icons";
ELECTRON_OZONE_PLATFORM_HINT = "wayland";
#GTK_THEME = "adw-gtk3";
};
};
"io.github.martchus.syncthingtray".Context.filesystems = ["/storage/games/heroic/Factorio/game/saves"];
"org.octave.Octave".Context.sockets = ["x11"];
"org.octave.Octave".Environment = {QT_QPA_PLATFORM = "xcb";};
"com.valvesoftware.Steam" = {
Context = {
sockets = ["x11" "wayland"];
filesystems = ["/storage/games/steam"];
};
Environment = {
STEAM_FORCE_DESKTOPUI_SCALING = "1.3";
};
};
"org.signal.Signal" = {
Environment = {
SIGNAL_PASSWORD_STORE = "gnome-libsecret";
};
};
"net.lutris.Lutris".Context = {
sockets = ["x11" "wayland"];
filesystems = ["/storage/games/lutris" "~/games/lutris"];
};
"com.heroicgameslauncher.hgl".Context = {
sockets = ["x11" "wayland"];
filesystems = ["/storage/games/heroic" "~/games/heroic"];
};
"com.usebottles.Bottles" = {
Context = {
sockets = ["x11" "wayland"];
filesystems = ["/home/user/docs/nure/tex-template/assets/BridgeKSG"];
};
};
};
};
}

View File

@ -0,0 +1,10 @@
{
imports = [
./console.nix
./flatpak.nix
./console/yazi.nix
./editor/main.nix
./shell/main.nix
./terminal/main.nix
];
}

View File

@ -0,0 +1,3 @@
{
imports = [./nushell.nix ./oh-my-posh.nix];
}

View File

@ -0,0 +1,100 @@
{
pkgs,
config,
lib,
...
}:
with lib; let
cfg = config.shell.nushell;
in {
options = {
shell.nushell.enable =
mkEnableOption "enable nushell";
};
config = mkIf cfg.enable {
programs.oh-my-posh.enableNushellIntegration = true;
programs.zoxide = {
enable = true;
enableNushellIntegration = true;
};
programs.carapace = {
enable = true;
enableNushellIntegration = true;
};
programs.atuin = {
enable = true;
enableNushellIntegration = true;
flags = [
"--disable-up-arrow"
];
};
programs.nushell = {
enable = true;
environmentVariables = {
CARAPACE_BRIDGES = "zsh,fish,bash,inshellisense";
CARAPACE_MATCH = 1;
EDITOR = "hx";
};
shellAliases = {
cd = "z";
cat = "bat";
l = "ls -l";
nix-shell = "nix-shell --command nu";
};
extraConfig = ''
$env.config = {
show_banner: false
shell_integration: {
# osc2 abbreviates the path if in the home_dir, sets the tab/window title, shows the running command in the tab/window title
osc2: true
# osc7 is a way to communicate the path to the terminal, this is helpful for spawning new tabs in the same directory
osc7: true
# osc8 is also implemented as the deprecated setting ls.show_clickable_links, it shows clickable links in ls output if your terminal supports it. show_clickable_links is deprecated in favor of osc8
osc8: true
# osc9_9 is from ConEmu and is starting to get wider support. It's similar to osc7 in that it communicates the path to the terminal
osc9_9: false
# osc133 is several escapes invented by Final Term which include the supported ones below.
# 133;A - Mark prompt start
# 133;B - Mark prompt end
# 133;C - Mark pre-execution
# 133;D;exit - Mark execution finished with exit code
# This is used to enable terminals to know where the prompt is, the command is, where the command finishes, and where the output of the command is
osc133: true
# osc633 is closely related to osc133 but only exists in visual studio code (vscode) and supports their shell integration features
# 633;A - Mark prompt start
# 633;B - Mark prompt end
# 633;C - Mark pre-execution
# 633;D;exit - Mark execution finished with exit code
# 633;E - Explicitly set the command line with an optional nonce
# 633;P;Cwd=<path> - Mark the current working directory and communicate it to the terminal
# and also helps with the run recent menu in vscode
osc633: true
# reset_application_mode is escape \x1b[?1l and was added to help ssh work better
reset_application_mode: true
}
ls: {
use_ls_colors: true
clickable_links: true
}
rm: {
always_trash: true
}
edit_mode: 'vi'
completions: {
case_sensitive: false
quick: true
partial: true
algorithm: "fuzzy"
external: {
enable: true
# max_results: 100
# completer: $carapace_completer # check 'carapace_completer'
}
}
}
'';
};
};
}

View File

@ -0,0 +1,106 @@
{
config,
lib,
...
}:
with lib; let
cfg = config.shell.oh-my-posh;
in {
options = {
shell.oh-my-posh.enable =
mkEnableOption "enable oh my posh";
};
config = mkIf cfg.enable {
programs.oh-my-posh = {
enable = true;
settings = {
version = 2;
final_space = true;
console_title_template = "{{ .Shell }} in {{ .Folder }}";
blocks = [
{
type = "prompt";
alignment = "left";
newline = true;
segments = [
{
type = "path";
style = "plain";
background = "transparent";
foreground = "blue";
template = "{{ .Path }}";
properties = {
style = "full";
};
}
{
type = "text";
style = "plain";
background = "transparent";
template = "{{ if .Env.BW_SESSION }} 󰞀{{ end }}";
}
{
type = "nix-shell";
style = "plain";
background = "transparent";
template = "{{ if ne .Type \"unknown\" }} {{ end }}";
}
{
type = "git";
style = "plain";
foreground = "p:grey";
background = "transparent";
template = " {{ .HEAD }}{{ if or (.Working.Changed) (.Staging.Changed) }}*{{ end }} <cyan>{{ if gt .Behind 0 }}{{ end }}{{ if gt .Ahead 0 }}{{ end }}</>";
properties = {
branch_icon = "";
commit_icon = "@";
fetch_status = true;
};
}
];
}
{
type = "rprompt";
overflow = "hidden";
segments = [
{
type = "executiontime";
style = "plain";
foreground = "yellow";
background = "transparent";
template = "{{ .FormattedMs }}";
properties = {
threshold = 5000;
};
}
];
}
{
type = "prompt";
alignment = "left";
newline = true;
segments = [
{
type = "text";
style = "plain";
foreground_templates = ["{{if gt .Code 0}}red{{end}}" "{{if eq .Code 0}}magenta{{end}}"];
background = "transparent";
template = "";
}
];
}
];
transient_prompt = {
foreground_templates = ["{{if gt .Code 0}}red{{end}}" "{{if eq .Code 0}}magenta{{end}}"];
background = "transparent";
template = " ";
};
secondary_prompt = {
foreground = "magenta";
background = "transparent";
template = " ";
};
};
};
};
}

View File

@ -0,0 +1,75 @@
{
pkgs,
config,
lib,
...
}: {
options = {
zsh.enable =
lib.mkEnableOption "enable z shell";
};
config = lib.mkIf config.zsh.enable {
programs.zsh = {
enable = true;
dotDir = ".config/zsh";
initExtra = ''
bindkey '^[[A' history-substring-search-up
bindkey '^[[B' history-substring-search-down
'';
# promptInit = "oh-my-posh init zsh -c ~/.config/oh-my-posh/zen.toml";
enableCompletion = true;
autosuggestion.enable = true;
#autosuggestion.highlight = "fg=#ff00ff,bg=cyan,bold,underline";
shellAliases = {
ls = "eza";
cat = "bat";
cd = "z";
l = "eza -alh";
};
history = {
size = 10000;
path = "${config.xdg.dataHome}/zsh/history";
};
plugins = [
{
name = "zsh-autosuggestions";
file = "zsh-autosuggestions.plugin.zsh";
src = pkgs.fetchFromGitHub {
owner = "zsh-users";
repo = "zsh-autocomplete";
rev = "v0.7.0";
sha256 = "sha256-/6V6IHwB5p0GT1u5SAiUa20LjFDSrMo731jFBq/bnpw=";
};
}
{
name = "zsh-syntax-highlighting";
src = pkgs.fetchFromGitHub {
owner = "zsh-users";
repo = "zsh-syntax-highlighting";
rev = "0.8.0";
sha256 = "sha256-iJdWopZwHpSyYl5/FQXEW7gl/SrKaYDEtTH9cGP7iPo=";
};
}
{
name = "zsh-history-substring-search";
src = pkgs.fetchFromGitHub {
owner = "zsh-users";
repo = "zsh-history-substring-search";
rev = "v1.1.0";
sha256 = "sha256-GSEvgvgWi1rrsgikTzDXokHTROoyPRlU0FVpAoEmXG4=";
};
}
{
name = "zsh-nix-shell";
file = "nix-shell.plugin.zsin.fromh";
src = pkgs.fetchFromGitHub {
owner = "chisui";
repo = "zsh-nix-shell";
rev = "v0.8.0";
sha256 = "1lzrn0n4fxfcgg65v0qhnj7wnybybqzs4adz7xsrkgmcsr0ii8b7";
};
}
];
};
};
}

View File

@ -0,0 +1,21 @@
{
config,
lib,
...
}:
with lib; let
cfg = config.terminal.ghostty;
in {
options = {
terminal.ghostty.enable = mkEnableOption "enable ghostty terminal";
};
config = mkIf cfg.enable {
programs.ghostty = {
enable = true;
settings = {
gtk-single-instance = true;
window-decoration = "client";
};
};
};
}

View File

@ -0,0 +1,24 @@
{
config,
lib,
...
}:
with lib; let
cfg = config.terminal.kitty;
in {
options = {
terminal.kitty.enable =
mkEnableOption "enable kitty terminal";
};
config = mkIf cfg.enable {
programs.kitty = {
enable = true;
settings = {
tab_bar_edge = "bottom";
tab_bar_align = "left";
tab_bar_style = "fade";
# tab_separator = " ";
};
};
};
}

View File

@ -0,0 +1,7 @@
{
imports = [
./kitty.nix
./ghostty.nix
./wezterm.nix
];
}

View File

@ -0,0 +1,90 @@
{
config,
inputs,
pkgs,
lib,
...
}:
with lib; let
cfg = config.terminal.wezterm;
in {
options = {
terminal.wezterm.enable =
mkEnableOption "enable wez's terminal";
};
config = mkIf cfg.enable {
programs.wezterm = {
enable = true;
package = inputs.wezterm.packages.${pkgs.system}.default;
extraConfig = ''
local wezterm = require 'wezterm'
local act = wezterm.action
return {
front_end = 'WebGpu',
unix_domains = {
{
name = 'unix',
},
},
enable_kitty_graphics = true,
window_padding = {
left = 0,
right = 0,
top = 0,
bottom = 0,
},
use_fancy_tab_bar = false,
inactive_pane_hsb = {
saturation = 0.8,
brightness = 0.7,
},
-- window_frame = {
-- font = wezterm.font { family = 'Cantarell', weight = 'Bold' },
-- },
disable_default_key_bindings = true,
leader = { key = 'Space', mods = 'CTRL', timeout_milliseconds = 2000 },
keys = {
{ key = 'n', mods = 'CTRL|SHIFT', action = act.ActivateTabRelative(-1) },
{ key = 'e', mods = 'CTRL|SHIFT', action = act.ActivatePaneDirection 'Down', },
{ key = 'u', mods = 'CTRL|SHIFT', action = act.ActivatePaneDirection 'Up', },
{ key = 'i', mods = 'CTRL|SHIFT', action = act.ActivateTabRelative(1) },
{ key = 'Enter', mods = 'SHIFT|CTRL', action = act.ActivateCopyMode },
{ key = 'R', mods = 'SHIFT|CTRL', action = act.ReloadConfiguration },
{ key = '+', mods = 'SHIFT|CTRL', action = act.IncreaseFontSize },
{ key = '-', mods = 'SHIFT|CTRL', action = act.DecreaseFontSize },
{ key = '0', mods = 'SHIFT|CTRL', action = act.ResetFontSize },
{ key = 'C', mods = 'SHIFT|CTRL', action = act.CopyTo 'Clipboard' },
-- { key = 'N', mods = 'SHIFT|CTRL', action = act.SpawnWindow },
{ key = 'l', mods = 'SHIFT|CTRL', action = act.CharSelect{ copy_on_select = true, copy_to = 'ClipboardAndPrimarySelection' } },
{ key = 'v', mods = 'SHIFT|CTRL', action = act.PasteFrom 'Clipboard' },
{ key = 'PageUp', mods = 'CTRL', action = act.ActivateTabRelative(-1) },
{ key = 'PageDown', mods = 'CTRL', action = act.ActivateTabRelative(1) },
{ key = 'LeftArrow', mods = 'CTRL', action = act.ActivatePaneDirection 'Left' },
{ key = 'RightArrow', mods = 'CTRL', action = act.ActivatePaneDirection 'Right' },
{ key = 'UpArrow', mods = 'CTRL', action = act.ActivatePaneDirection 'Up' },
{ key = 'DownArrow', mods = 'CTRL', action = act.ActivatePaneDirection 'Down' },
{ key = ',', mods = 'SHIFT|CTRL', action = act.SplitVertical { domain = 'CurrentPaneDomain' }, },
{ key = '.', mods = 'SHIFT|CTRL', action = act.SplitHorizontal { domain = 'CurrentPaneDomain' }, },
{ key = '%', mods = 'SHIFT|CTRL', action = act.SplitVertical { domain = 'CurrentPaneDomain' }, },
{ key = '"', mods = 'SHIFT|CTRL', action = act.SplitHorizontal { domain = 'CurrentPaneDomain' }, },
{ key = 'n', mods = 'CTRL', action = act.ActivatePaneDirection 'Left', },
{ key = 'i', mods = 'CTRL', action = act.ActivatePaneDirection 'Right', },
{ key = 't', mods = 'SHIFT|CTRL', action = act.SpawnTab 'CurrentPaneDomain' },
{ key = 'w', mods = 'SHIFT|CTRL', action = act.CloseCurrentTab{ confirm = false } },
{ key = 'f', mods = 'SHIFT|CTRL', action = act.CloseCurrentPane{ confirm = false } },
{ key = 'b', mods = 'LEADER|CTRL', action = act.SendString '\x02', },
{ key = 'Enter', mods = 'LEADER', action = act.ActivateCopyMode, },
{ key = 'p', mods = 'LEADER', action = act.PasteFrom 'PrimarySelection', },
{ key = 'k', mods = 'SHIFT|CTRL', action = act.Multiple
{
act.ClearScrollback 'ScrollbackAndViewport',
act.SendKey { key = 'L', mods = 'CTRL' },
},
},
{ key = 'r', mods = 'LEADER', action = act.ActivateKeyTable { name = 'resize_pane', one_shot = false, }, }
},
}
'';
};
};
}