system/users/jan/shell/zsh.nix
2022-10-09 14:14:04 +03:00

51 lines
1 KiB
Nix

{ lib, config, pkgs, ... }:
with lib;
let
cfg = config.shell.zsh;
in
{
options.shell.zsh = {
enable = mkOption {
type = types.bool;
default = false;
description = "Add z shell";
};
};
config = mkIf cfg.enable {
# fish and zsh support for nix-shell
home.packages = with pkgs; [ any-nix-shell ];
programs.zsh = {
enable = true;
enableAutosuggestions = true;
enableCompletion = true;
defaultKeymap = "viins";
dotDir = ".config/zsh";
history = {
path = "${config.xdg.dataHome}/zsh/zsh_history";
expireDuplicatesFirst = true;
ignorePatterns = [
"rm *"
"kill *"
];
};
oh-my-zsh = {
enable = true;
theme = mkIf (!config.shell.prompt.starship.enable) "robbyrussell";
};
initExtra = ''
any-nix-shell zsh --info-right | source /dev/stdin
eval "$(cat $HOME/repos/tas/shell/zsh)"
eval $(kubectl completion zsh)
'';
};
};
}