2022-04-27 01:17:51 +03:00
|
|
|
{ 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";
|
|
|
|
};
|
|
|
|
};
|
2022-08-29 15:40:41 +03:00
|
|
|
|
2022-04-27 01:17:51 +03:00
|
|
|
config = mkIf cfg.enable {
|
2022-08-24 14:02:45 +03:00
|
|
|
# fish and zsh support fo nix-shell
|
|
|
|
home.packages = with pkgs; [ any-nix-shell ];
|
|
|
|
|
2022-04-27 01:17:51 +03:00
|
|
|
programs.zsh = {
|
|
|
|
enable = true;
|
|
|
|
enableAutosuggestions = true;
|
2022-07-03 13:44:20 +03:00
|
|
|
enableCompletion = true;
|
2022-04-27 01:17:51 +03:00
|
|
|
defaultKeymap = "viins";
|
|
|
|
dotDir = ".config/zsh";
|
|
|
|
|
|
|
|
history = {
|
|
|
|
path = "${config.xdg.dataHome}/zsh/zsh_history";
|
|
|
|
expireDuplicatesFirst = true;
|
|
|
|
ignorePatterns = [
|
|
|
|
"rm *"
|
|
|
|
"kill *"
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
|
|
|
oh-my-zsh = {
|
2022-08-28 04:56:05 +03:00
|
|
|
enable = true;
|
|
|
|
theme = mkIf config.shell.prompt.starship.enable "robbyrussell";
|
2022-04-27 01:17:51 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
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
|
|
|
|
'';
|
2022-08-19 16:37:18 +03:00
|
|
|
|
|
|
|
initExtra = ''
|
2022-08-24 14:02:45 +03:00
|
|
|
any-nix-shell zsh --info-right | source /dev/stdin
|
|
|
|
|
2022-08-19 16:37:18 +03:00
|
|
|
eval "$(cat $HOME/repos/tas/shell/zsh)"
|
2022-08-28 04:54:03 +03:00
|
|
|
|
|
|
|
eval $(kubectl completion zsh)
|
2022-08-19 16:37:18 +03:00
|
|
|
'';
|
2022-04-27 01:17:51 +03:00
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|