system/home/shell/zsh.nix

69 lines
1.4 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 fo 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 = !config.shell.prompt.starship.enable;
theme = "robbyrussell";
};
initExtraFirst = ''
# nix
if [ -e $HOME/.nix-profile/etc/profile.d/nix.sh ]; then
source $HOME/.nix-profile/etc/profile.d/nix.sh;
fi
source $HOME/.nix-profile/etc/profile.d/hm-session-vars.sh
export NIX_PATH=$HOME/.nix-defexpr/channels''${NIX_PATH:+:$NIX_PATH}
# ghcup
if [ -f "$HOME/.ghcup/env" ]; then
source "$HOME/.ghcup/env"
fi
'';
initExtra = ''
any-nix-shell zsh --info-right | source /dev/stdin
eval "$(cat $HOME/repos/tas/shell/zsh)"
eval $(kubectl completion zsh)
'';
};
};
}