system/modules/home-manager/shell.nix

73 lines
1.6 KiB
Nix

{ lib, config, pkgs, ... }:
{
options.local.shell.enable = lib.mkEnableOption "enable shell";
config = lib.mkIf config.local.shell.enable {
# fish and zsh support for nix-shell
home.packages = with pkgs; [ any-nix-shell ];
programs.zsh = {
enable = true;
autosuggestion.enable = 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;
initExtra = ''
any-nix-shell zsh --info-right | source /dev/stdin
'';
};
programs.starship = {
enable = true;
enableZshIntegration = config.programs.zsh.enable;
settings = {
add_newline = true;
format = lib.concatStrings [
"$hostname"
"$directory"
"$git_branch"
"$git_commit"
"$git_state"
"$git_metrics"
"$git_status"
"$shlvl"
"$nix_shell"
"$cmd_duration"
"$jobs"
"$line_break"
"$character"
];
character = {
success_symbol = "[](bold green)";
error_symbol = "[](bold red)";
};
git_commit.commit_hash_length = 6;
shlvl = {
disabled = false;
format = "[$symbol$shlvl]($style) ";
symbol = " ";
threshold = 3;
};
hostname.ssh_symbol = "";
};
};
};
}