system/home/shell/zsh.nix

56 lines
1.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";
};
initExtraFirst = ''
# nix
source $HOME/.nix-profile/etc/profile.d/hm-session-vars.sh
'';
initExtra = ''
any-nix-shell zsh --info-right | source /dev/stdin
eval "$(cat $HOME/repos/tas/shell/zsh)"
eval $(kubectl completion zsh)
'';
};
};
}