dotfiles/home/apps/zsh.nix

149 lines
3.6 KiB
Nix
Raw Normal View History

{
2023-02-10 07:46:37 +01:00
config,
flakePath,
pkgs,
...
}: let
inherit (pkgs.stdenv.hostPlatform) isDarwin;
2023-02-15 06:27:38 +01:00
symlink = fileName: {recursive ? false}: {
source = config.lib.file.mkOutOfStoreSymlink "${flakePath}/${fileName}";
recursive = recursive;
};
zshPlugins = plugins: (map (plugin: rec {
name = src.name;
inherit (plugin) file src;
})
plugins);
in {
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";
};
};
2023-02-17 22:07:13 +01:00
bat.enable = true;
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;
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"];
};
lsd = {
enable = true;
enableAliases = true;
};
2023-03-05 14:53:36 +01:00
nix-index.enable = true;
2023-05-17 12:02:03 +02:00
starship.enable = true;
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;
enableAutosuggestions = true;
enableCompletion = true;
initExtra = let
2023-02-10 06:34:05 +01:00
functionsDir = "${config.home.homeDirectory}/${config.programs.zsh.dotDir}/functions";
2023-02-10 07:46:37 +01:00
in ''
for script in "${functionsDir}"/**/*; do
source "$script"
done
'';
envExtra = ''
export LESSHISTFILE="-"
export ZVM_INIT_MODE="sourcing"
export ZVM_CURSOR_BLINKING_BEAM="1"
'';
dotDir = ".config/zsh";
oh-my-zsh = {
enable = true;
plugins = [
"colored-man-pages"
"colorize"
2023-03-15 20:05:57 +01:00
"docker"
"docker-compose"
"git"
"kubectl"
];
};
plugins = with pkgs; (zshPlugins [
{
src = zsh-vi-mode;
file = "share/zsh-vi-mode/zsh-vi-mode.plugin.zsh";
}
{
src = zsh-nix-shell;
2023-02-17 17:26:53 +01:00
file = "share/zsh-nix-shell/nix-shell.plugin.zsh";
}
{
src = zsh-fast-syntax-highlighting;
file = "share/zsh/site-functions/fast-syntax-highlighting.plugin.zsh";
}
]);
shellAliases = {
cat =
if isDarwin
2023-02-15 06:40:45 +01:00
then "bat --theme=\$(defaults read -globalDomain AppleInterfaceStyle &> /dev/null && echo Catppuccin-mocha || echo Catppuccin-latte)"
else "bat";
2023-06-22 01:09:01 +02:00
cp = "cp -i";
mv = "mv -i";
rm = "rm -i";
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"'';
tree = "lsd --tree";
};
history.path = "${config.xdg.configHome}/zsh/history";
};
};
xdg.configFile = {
2023-02-19 00:18:25 +01:00
"lsd" = symlink "home/apps/lsd" {recursive = true;};
"starship.toml" = symlink "home/apps/starship/config.toml" {};
"zsh/functions" = symlink "home/apps/zsh/functions" {recursive = true;};
};
}