Switch shell to zsh

This commit is contained in:
SebastianStork 2024-05-21 08:57:19 +02:00
parent a96014bee2
commit c98192eb68
8 changed files with 1795 additions and 63 deletions

View file

@ -5,21 +5,22 @@
...
}:
{
options.myConfig.shell.enhancement.enable = lib.mkEnableOption "";
config = lib.mkIf config.myConfig.shell.enhancement.enable {
programs.fzf.enable = true;
programs.zoxide = {
enable = true;
options = [ "--cmd cd" ];
};
config = lib.mkIf config.myConfig.shell.enable {
home.shellAliases =
let
nixAliases =
let
rebuild = "sudo -v && nh os";
in
{
nrs = "${rebuild} switch";
nrt = "${rebuild} test";
nrb = "${rebuild} boot";
nrrb = "nrb && reboot";
};
lsAliases =
let
listCmd = "${lib.getExe pkgs.eza} --header --group --time-style=long-iso --group-directories-first --sort=name --icons=auto --git --git-repos-no-status --binary";
aliasList =
lib.mapCartesianProduct
(
@ -48,7 +49,7 @@
};
convertAliasToCmd =
str:
"${listCmd} "
"${lib.getExe pkgs.eza} --header --group --time-style=long-iso --group-directories-first --sort=name --icons=auto --git --git-repos-no-status --binary "
+ (builtins.replaceStrings
[
"ll"
@ -68,9 +69,8 @@
]
str
);
aliasAttrs = lib.genAttrs aliasList convertAliasToCmd;
in
aliasAttrs // { ls = "l"; };
(lib.genAttrs aliasList convertAliasToCmd) // { ls = "l"; };
catAlias =
let
@ -86,6 +86,7 @@
};
in
lib.mkMerge [
nixAliases
lsAliases
catAlias
];

View file

@ -1,20 +1,49 @@
{ config, lib, ... }:
let
cfg = config.myConfig.shell;
in
{
imports = [
./starship.nix
./enhancement.nix
./p10k
./aliases.nix
];
options.myConfig.shell = {
bash.enable = lib.mkEnableOption "";
zsh.enable = lib.mkEnableOption "";
enable = lib.mkEnableOption "";
};
config = {
programs.bash.enable = cfg.bash.enable;
programs.zsh.enable = cfg.zsh.enable;
programs.zsh = {
enable = true;
dotDir = ".config/zsh";
autocd = true;
autosuggestion.enable = true;
syntaxHighlighting.enable = true;
history = {
ignoreAllDups = true;
path = "${config.xdg.dataHome}/zsh/zsh_history";
};
initExtraFirst = ''
(( ''${+commands[direnv]} )) && emulate zsh -c "$(direnv export zsh)"
if [[ -r "''${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-''${(%):-%n}.zsh" ]]; then
source "''${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-''${(%):-%n}.zsh"
fi
(( ''${+commands[direnv]} )) && emulate zsh -c "$(direnv hook zsh)"
'';
};
programs.fzf.enable = true;
programs.zoxide = {
enable = true;
options = [ "--cmd cd" ];
};
programs.direnv = {
enable = true;
nix-direnv.enable = true;
config.global.hide_env_diff = true;
};
};
}

View file

@ -0,0 +1,22 @@
{
config,
pkgs,
lib,
...
}:
{
config = lib.mkIf config.myConfig.shell.enable {
programs.zsh.plugins = [
{
name = "powerlevel10k";
src = pkgs.zsh-powerlevel10k;
file = "share/zsh-powerlevel10k/powerlevel10k.zsh-theme";
}
{
name = "powerlevel10k-config";
src = ./.;
file = "p10k.zsh";
}
];
};
}

File diff suppressed because it is too large Load diff

View file

@ -1,19 +0,0 @@
{ config, lib, ... }:
{
options.myConfig.shell.starship.enable = lib.mkEnableOption "";
config.programs.starship = lib.mkIf config.myConfig.shell.starship.enable {
enable = true;
enableBashIntegration = true;
enableZshIntegration = true;
settings = {
directory = {
truncation_length = 0;
truncation_symbol = "/";
truncate_to_repo = true;
};
};
};
}