mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-01-21 16:21:34 +01:00
Switch shell to zsh
This commit is contained in:
parent
a96014bee2
commit
c98192eb68
8 changed files with 1795 additions and 63 deletions
|
|
@ -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
|
||||
];
|
||||
|
|
@ -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;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
22
modules/home/shell/p10k/default.nix
Normal file
22
modules/home/shell/p10k/default.nix
Normal 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";
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
1712
modules/home/shell/p10k/p10k.zsh
Normal file
1712
modules/home/shell/p10k/p10k.zsh
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -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;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -11,22 +11,6 @@ in
|
|||
config = lib.mkIf cfg.enable {
|
||||
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 {
|
||||
enable = true;
|
||||
dates = "daily";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue