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

@ -33,6 +33,13 @@
console.keyMap = "de-latin1-nodeadkeys"; console.keyMap = "de-latin1-nodeadkeys";
programs.zsh = {
enable = true;
autosuggestions.enable = true;
syntaxHighlighting.enable = true;
};
users.defaultUserShell = pkgs.zsh;
programs.neovim = { programs.neovim = {
enable = true; enable = true;
defaultEditor = true; defaultEditor = true;

View file

@ -5,21 +5,22 @@
... ...
}: }:
{ {
options.myConfig.shell.enhancement.enable = lib.mkEnableOption ""; config = lib.mkIf config.myConfig.shell.enable {
config = lib.mkIf config.myConfig.shell.enhancement.enable {
programs.fzf.enable = true;
programs.zoxide = {
enable = true;
options = [ "--cmd cd" ];
};
home.shellAliases = home.shellAliases =
let let
nixAliases =
let
rebuild = "sudo -v && nh os";
in
{
nrs = "${rebuild} switch";
nrt = "${rebuild} test";
nrb = "${rebuild} boot";
nrrb = "nrb && reboot";
};
lsAliases = lsAliases =
let 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 = aliasList =
lib.mapCartesianProduct lib.mapCartesianProduct
( (
@ -48,7 +49,7 @@
}; };
convertAliasToCmd = convertAliasToCmd =
str: 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 + (builtins.replaceStrings
[ [
"ll" "ll"
@ -68,9 +69,8 @@
] ]
str str
); );
aliasAttrs = lib.genAttrs aliasList convertAliasToCmd;
in in
aliasAttrs // { ls = "l"; }; (lib.genAttrs aliasList convertAliasToCmd) // { ls = "l"; };
catAlias = catAlias =
let let
@ -86,6 +86,7 @@
}; };
in in
lib.mkMerge [ lib.mkMerge [
nixAliases
lsAliases lsAliases
catAlias catAlias
]; ];

View file

@ -1,20 +1,49 @@
{ config, lib, ... }: { config, lib, ... }:
let
cfg = config.myConfig.shell;
in
{ {
imports = [ imports = [
./starship.nix ./p10k
./enhancement.nix ./aliases.nix
]; ];
options.myConfig.shell = { options.myConfig.shell = {
bash.enable = lib.mkEnableOption ""; enable = lib.mkEnableOption "";
zsh.enable = lib.mkEnableOption "";
}; };
config = { config = {
programs.bash.enable = cfg.bash.enable; programs.zsh = {
programs.zsh.enable = cfg.zsh.enable; 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;
};
};
};
}

View file

@ -11,22 +11,6 @@ in
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
programs.nh.enable = true; programs.nh.enable = true;
environment.shellAliases =
let
rebuild = "sudo -v && nh os";
in
{
nrs = "${rebuild} switch";
nrt = "${rebuild} test";
nrb = "${rebuild} boot";
nrrb = "nrb && reboot";
};
programs.direnv = {
enable = true;
silent = true;
};
programs.nh.clean = lib.mkIf cfg.auto-gc.enable { programs.nh.clean = lib.mkIf cfg.auto-gc.enable {
enable = true; enable = true;
dates = "daily"; dates = "daily";

View file

@ -11,11 +11,7 @@
myConfig = { myConfig = {
de.hyprland.enable = osConfig.myConfig.de.hyprland.enable; de.hyprland.enable = osConfig.myConfig.de.hyprland.enable;
shell = { shell.enable = true;
bash.enable = true;
starship.enable = true;
enhancement.enable = true;
};
ssh-client.enable = true; ssh-client.enable = true;
git.enable = true; git.enable = true;