nixos-configs/modules/desktop/zsh.nix

64 lines
1.7 KiB
Nix
Raw Normal View History

2023-03-21 10:37:27 +01:00
{ config, lib, pkgs, ... }:
with lib;
with lib.my;
let cfg = config.modules.desktop.zsh;
in {
2023-06-10 09:50:14 +02:00
options.modules.desktop.zsh = { enable = mkBoolOpt false; };
2023-03-21 10:37:27 +01:00
config = mkIf cfg.enable {
environment.pathsToLink = [ "/share/zsh" ];
2023-06-10 09:50:14 +02:00
programs.zsh.enable = true;
2023-03-21 14:42:39 +01:00
2023-06-10 09:50:14 +02:00
users.users.${config.user.name} = { shell = pkgs.zsh; };
2023-03-21 14:42:39 +01:00
2023-03-21 10:37:27 +01:00
home-manager.users.${config.user.name} = {
2023-06-10 09:50:14 +02:00
programs.zsh = {
enable = true;
history = {
save = 50000;
size = 50000;
};
enableCompletion = true;
enableAutosuggestions = true;
enableSyntaxHighlighting = true;
initExtra = ''
source ${./p10k.zsh}
autoload -Uz up-line-or-beginning-search down-line-or-beginning-search
zle -N up-line-or-beginning-search
zle -N down-line-or-beginning-search
2023-03-21 10:37:27 +01:00
2023-06-10 09:50:14 +02:00
[[ -n "$key[Up]" ]] && bindkey -- "$key[Up]" up-line-or-beginning-search
[[ -n "$key[Down]" ]] && bindkey -- "$key[Down]" down-line-or-beginning-search
2023-03-21 10:37:27 +01:00
2023-06-10 09:50:14 +02:00
eval $(${pkgs.thefuck}/bin/thefuck --alias)
'';
oh-my-zsh = {
enable = true;
plugins = [ "git" "terraform" "systemd" ];
2023-03-21 10:37:27 +01:00
};
2023-06-10 09:50:14 +02:00
plugins = [
{
name = "powerlevel10k";
src = pkgs.zsh-powerlevel10k;
file = "share/zsh-powerlevel10k/powerlevel10k.zsh-theme";
}
{
name = "powerlevel10k-config";
src = ./p10k.zsh;
}
{
name = "nix-zsh-completions";
src = pkgs.nix-zsh-completions;
}
{
name = "zsh-completions";
src = pkgs.zsh-completions;
}
];
};
2023-03-21 10:37:27 +01:00
};
};
}