dotfiles/home/apps/zsh.nix

114 lines
2.6 KiB
Nix
Raw Normal View History

{
2023-02-10 07:46:37 +01:00
config,
flakePath,
lib,
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;
};
in {
home.sessionVariables = {LESSHISTFILE = "-";};
programs = {
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;
lsd = {
enable = true;
enableAliases = true;
};
mcfly.enable = true;
2023-03-05 14:53:36 +01:00
nix-index.enable = true;
starship = {
enable = true;
2023-02-15 06:27:38 +01:00
package = pkgs.unstable.starship;
};
tealdeer = {
enable = true;
settings.updates.auto_update = true;
};
zoxide.enable = true;
zsh = {
enable = true;
enableAutosuggestions = true;
enableCompletion = true;
enableSyntaxHighlighting = 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 conf in "${functionsDir}"/**/*.zsh; do
source "$conf"
done
[[ "$TERM_PROGRAM" == "WezTerm" ]] && TERM=wezterm
'';
envExtra = ''
export PATH="$PATH:${config.xdg.dataHome}/krew/bin"
export ZVM_INIT_MODE=sourcing
'';
dotDir = ".config/zsh";
oh-my-zsh = {
enable = true;
plugins = [
"colored-man-pages"
"colorize"
"docker-compose"
"git"
"kubectl"
];
};
plugins = [
{
name = "zsh-vi-mode";
src = pkgs.zsh-vi-mode;
file = "share/zsh-vi-mode/zsh-vi-mode.plugin.zsh";
}
{
name = "zsh-nix-shell";
2023-02-17 17:26:53 +01:00
src = pkgs.zsh-nix-shell;
file = "share/zsh-nix-shell/nix-shell.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-02-15 06:40:45 +01:00
# switch between yubikeys for the same GPG key
2023-02-10 07:46:37 +01:00
switch_yubikeys = "gpg-connect-agent \"scd serialno\" \"learn --force\" /bye";
};
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;};
};
}