configuration.nix/modules/programs/zsh.nix

56 lines
1.4 KiB
Nix
Raw Normal View History

2023-11-14 15:50:11 +01:00
{ pkgs, lib, config, ... }:
let
2023-11-14 18:57:53 +01:00
cfg = config.programs.shell;
2023-11-14 15:50:11 +01:00
in
{
options.programs.shell = {
enable = lib.mkEnableOption "shell";
};
config = lib.mkIf cfg.enable {
programs.zsh = {
enable = true;
syntaxHighlighting.enable = true;
enableAutosuggestions = true;
loginExtra = ''
2023-11-14 20:00:01 +01:00
[ "$(tty)" = "/dev/tty1" ] && exec sway
2023-11-14 15:50:11 +01:00
'';
sessionVariables = {
PASSWORD_STORE_DIR = "$HOME/.password-store";
};
shellAliases = {
cal = "cal $(date +%Y)";
ssh = "TERM=xterm-256color ssh";
GG = "git add . && git commit -m 'GG' && git push --set-upstream origin $(git rev-parse --abbrev-ref HEAD)";
gad = "git add . && git diff --cached";
gac = "ga && gc";
gach = "gac -C HEAD";
ga = "git add .";
gc = "git commit";
dev = "nix develop --command $SHELL";
la = "ls -alh";
torrent = "transmission-remote";
2023-11-18 07:53:15 +01:00
vi = "nvim";
2023-11-14 15:50:11 +01:00
};
history = {
expireDuplicatesFirst = true;
};
plugins = [
{
name = "zsh-powerlevel10k";
src = "${pkgs.zsh-powerlevel10k}/share/zsh-powerlevel10k";
file = "powerlevel10k.zsh-theme";
}
{
name = "zsh-nix-shell";
file = "nix-shell.plugin.zsh";
src = "${pkgs.zsh-nix-shell}/share/zsh-nix-shell";
}
];
initExtra = ''
source "$HOME/.p10k.zsh"
'';
};
};
}