system/nix/shell/zsh.nix

57 lines
1.1 KiB
Nix
Raw Normal View History

{ 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 {
programs.zsh = {
enable = true;
enableAutosuggestions = 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 = "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
'';
};
};
}