dotfiles/home/apps/zsh.nix

234 lines
5.5 KiB
Nix
Raw Normal View History

{
2023-02-10 07:46:37 +01:00
config,
2023-09-03 00:48:39 +02:00
lib,
2023-02-10 07:46:37 +01:00
pkgs,
...
}: let
2024-02-15 18:49:22 +01:00
srcs = pkgs.callPackage ../../_sources/generated.nix {};
zshPlugins = plugins: (map (plugin: rec {
name = src.name;
inherit (plugin) file src;
})
plugins);
2024-03-10 10:54:10 +01:00
overrides = {
mocha = {
rosewater = "#ece3e1";
flamingo = "#e1d2d2";
pink = "#ddccd8";
mauve = "#bbb2c9";
red = "#c4a2aa";
maroon = "#cbadb1";
peach = "#d5beb4";
yellow = "#ece3d3";
green = "#b9ddb6";
teal = "#badad4";
sky = "#b8d4db";
sapphire = "#a9c0ce";
blue = "#aab3c7";
lavender = "#bfc1d2";
text = "#d3d6e1";
subtext1 = "#bec2d2";
subtext0 = "#a8adc3";
overlay2 = "#9299b4";
overlay1 = "#7c84a5";
overlay0 = "#686f94";
surface2 = "#555a7b";
surface1 = "#434664";
surface0 = "#30314b";
base = "#101010";
mantle = "#090909";
crust = "#080808";
};
};
2024-03-10 23:57:29 +01:00
ctpBat = pkgs.denoPlatform.mkDenoDerivation {
inherit (srcs.catppuccin-bat) pname version src;
buildPhase = ''
deno run -A ./src/main.ts --overrides '${builtins.toJSON overrides}'
'';
installPhase = ''
mkdir -p $out
cp ./themes/* $out/
'';
};
2024-03-10 10:54:10 +01:00
ctpZshFsh = pkgs.denoPlatform.mkDenoDerivation {
inherit (srcs.catppuccin-zsh-fsh) pname version src;
buildPhase = ''
deno run -A ./build.ts --overrides '${builtins.toJSON overrides}'
'';
installPhase = ''
mkdir -p $out
cp ./themes/* $out/
'';
};
in {
2024-03-13 09:08:27 +01:00
home.sessionVariables = {
LESS = "-R --use-color";
LESSHISTFILE = "-";
MANPAGER = "sh -c 'col -bx | bat -l man -p'";
};
programs = {
atuin = {
enable = true;
flags = ["--disable-up-arrow"];
settings = {
inline_height = 30;
style = "compact";
2023-07-08 04:36:22 +02:00
sync_address = "https://atuin.winston.sh";
sync_frequency = "5m";
};
};
2024-02-15 18:49:22 +01:00
bat = {
2023-07-13 08:45:39 +02:00
enable = true;
themes = {
2024-03-07 13:40:26 +01:00
"Catppuccin Latte" = {
2024-03-10 23:57:29 +01:00
src = ctpBat;
file = "Catppuccin Latte.tmTheme";
};
2024-03-07 13:40:26 +01:00
"Catppuccin Frappe" = {
2024-03-10 23:57:29 +01:00
src = ctpBat;
file = "Catppuccin Frappe.tmTheme";
2024-03-07 13:40:26 +01:00
};
"Catppuccin Macchiato" = {
2024-03-10 23:57:29 +01:00
src = ctpBat;
file = "Catppuccin Macchiato.tmTheme";
2024-03-07 13:40:26 +01:00
};
"Catppuccin Mocha" = {
2024-03-10 23:57:29 +01:00
src = ctpBat;
file = "Catppuccin Mocha.tmTheme";
};
2023-07-13 08:45:39 +02:00
};
};
2023-02-17 17:26:53 +01:00
btop = {
enable = true;
settings = {
theme_background = false;
vim_keys = true;
};
};
direnv.enable = true;
direnv.nix-direnv.enable = true;
2024-03-14 22:12:11 +01:00
eza = {
enable = true;
icons = true;
extraOptions = [
"--group"
"--group-directories-first"
"--no-permissions"
"--octal-permissions"
];
};
fzf = {
enable = true;
2023-05-17 12:02:03 +02:00
colors = {
fg = "#cdd6f4";
"fg+" = "#cdd6f4";
hl = "#f38ba8";
"hl+" = "#f38ba8";
header = "#ff69b4";
info = "#cba6f7";
marker = "#f5e0dc";
pointer = "#f5e0dc";
prompt = "#cba6f7";
spinner = "#f5e0dc";
};
defaultOptions = ["--height=30%" "--layout=reverse" "--info=inline"];
};
2024-03-13 09:08:27 +01:00
less.enable = true;
nix-index-database.comma.enable = true;
2024-02-15 18:49:22 +01:00
starship = {
enable = true;
settings = builtins.fromTOML (builtins.readFile ./starship/config.toml);
};
tealdeer = {
enable = true;
2023-03-16 12:51:20 +01:00
settings = {
style = {
description.foreground = "white";
command_name.foreground = "green";
example_text.foreground = "blue";
example_code.foreground = "white";
example_variable.foreground = "yellow";
};
updates.auto_update = true;
};
};
zoxide.enable = true;
zsh = {
enable = true;
autosuggestion.enable = true;
enableCompletion = true;
initExtraFirst = ''
zvm_config() {
ZVM_INIT_MODE=sourcing
ZVM_CURSOR_STYLE_ENABLED=false
ZVM_VI_HIGHLIGHT_BACKGROUND=black
ZVM_VI_HIGHLIGHT_EXTRASTYLE=bold,underline
ZVM_VI_HIGHLIGHT_FOREGROUND=white
}
'';
2024-02-15 18:49:22 +01:00
initExtra = ''
for script in "${./zsh/functions}"/**/*; do source "$script"; done
'';
dotDir = ".config/zsh";
oh-my-zsh = {
enable = true;
2023-09-03 00:48:39 +02:00
plugins =
2024-03-07 13:41:11 +01:00
["colored-man-pages" "colorize" "git" "kubectl"]
2024-02-15 18:49:22 +01:00
++ lib.optionals pkgs.stdenv.isDarwin ["dash" "macos"];
};
2024-02-15 18:49:22 +01:00
plugins = zshPlugins [
{
2024-02-15 18:49:22 +01:00
src = pkgs.zsh-vi-mode;
file = "share/zsh-vi-mode/zsh-vi-mode.plugin.zsh";
}
{
2024-02-15 18:49:22 +01:00
src = pkgs.zsh-nix-shell;
2023-02-17 17:26:53 +01:00
file = "share/zsh-nix-shell/nix-shell.plugin.zsh";
}
{
2024-02-15 18:49:22 +01:00
src = pkgs.zsh-fast-syntax-highlighting.overrideAttrs (_: {
src = srcs.zsh-fast-syntax-highlighting.src;
2023-07-13 08:45:39 +02:00
});
file = "share/zsh/site-functions/fast-syntax-highlighting.plugin.zsh";
}
2024-02-15 18:49:22 +01:00
];
shellAliases = {
2024-03-13 09:08:27 +01:00
cat = "bat";
2024-03-14 22:12:11 +01:00
ls = "eza";
ll = "eza -l";
la = "eza -a";
lt = "eza -T";
lla = "eza -la";
llt = "eza -lT";
2023-06-22 01:09:01 +02:00
cp = "cp -i";
mv = "mv -i";
rm = "rm -i";
2024-03-14 22:12:11 +01:00
2023-02-15 06:40:45 +01:00
# switch between yubikeys for the same GPG key
switch_yubikeys = ''gpg-connect-agent "scd serialno" "learn --force" "/bye"'';
2024-03-14 22:12:11 +01:00
2023-08-25 23:23:54 +02:00
# podman
docker = "podman";
docker-compose = "podman-compose";
};
history.path = "${config.xdg.configHome}/zsh/history";
};
};
2024-03-10 10:54:10 +01:00
xdg.configFile."fsh".source = "${ctpZshFsh}";
}