dotfiles/home/apps/zsh.nix

205 lines
5.3 KiB
Nix
Raw Normal View History

{
2023-02-10 07:46:37 +01:00
config,
flakePath,
2023-09-03 00:48:39 +02:00
lib,
2023-02-10 07:46:37 +01:00
pkgs,
...
}: let
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);
2023-11-15 21:02:53 +01:00
catppuccin-zsh-fsh = pkgs.stdenvNoCC.mkDerivation {
name = "catppuccin-zsh-fsh";
src = pkgs.fetchFromGitHub {
owner = "catppuccin";
repo = "zsh-fsh";
rev = "7cdab58bddafe0565f84f6eaf2d7dd109bd6fc18";
sha256 = "sha256-31lh+LpXGe7BMZBhRWvvbOTkwjOM77FPNaGy6d26hIA=";
};
phases = ["buildPhase"];
buildPhase = ''
mkdir -p $out/share/zsh/site-functions/themes
ls $src/themes
cp $src/themes/* $out/share/zsh/site-functions/themes/
'';
};
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-07-13 08:45:39 +02:00
bat = let
src = pkgs.fetchFromGitHub {
2023-07-13 08:45:39 +02:00
owner = "catppuccin";
repo = "bat";
rev = "ba4d16880d63e656acced2b7d4e034e4a93f74b1";
sha256 = "sha256-6WVKQErGdaqb++oaXnY3i6/GuH2FhTgK0v4TN4Y0Wbw=";
};
in {
enable = true;
themes = {
"catppuccin-latte" = {
inherit src;
file = "Catppuccin-latte.tmTheme";
};
"catppuccin-mocha" = {
inherit src;
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;
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;
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
}
'';
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="-"
'';
dotDir = ".config/zsh";
oh-my-zsh = {
enable = true;
2023-09-03 00:48:39 +02:00
plugins =
[
"colored-man-pages"
"colorize"
"docker"
"docker-compose"
"git"
"kubectl"
]
++ lib.optionals pkgs.stdenv.isDarwin [
"dash"
"macos"
];
};
plugins = with pkgs; (zshPlugins [
{
src = zsh-vi-mode.overrideAttrs (old: {
src = fetchFromGitHub {
inherit (old.src) repo owner;
rev = "a3d717831c1864de8eabf20b946d66afc67e6695";
hash = "sha256-peoyY+krpK/7dA3TW6PEpauDwZLe+riVWfwpFYnRn1Q=";
};
});
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";
}
{
2023-07-13 08:45:39 +02:00
src = zsh-fast-syntax-highlighting.overrideAttrs (old: {
src = fetchFromGitHub {
inherit (old.src) repo owner;
2023-07-13 08:45:39 +02:00
rev = "cf318e06a9b7c9f2219d78f41b46fa6e06011fd9";
hash = "sha256-RVX9ZSzjBW3LpFs2W86lKI6vtcvDWP6EPxzeTcRZua4=";
};
});
file = "share/zsh/site-functions/fast-syntax-highlighting.plugin.zsh";
}
]);
shellAliases = {
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";
2023-08-25 23:23:54 +02:00
# podman
docker = "podman";
docker-compose = "podman-compose";
};
history.path = "${config.xdg.configHome}/zsh/history";
};
};
xdg.configFile = {
2023-11-15 21:02:53 +01:00
"fsh".source = "${catppuccin-zsh-fsh}/share/zsh/site-functions/themes";
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;};
};
}