Files
NixOsConfig/modules/user/zsh.nix
T

123 lines
3.7 KiB
Nix

{ config, pkgs, ... }: {
home.packages = [ pkgs.nh ];
programs = {
zoxide.enable = true;
fzf.enable = true;
starship = {
enable = true;
enableZshIntegration = true;
settings = {
add_newline = true;
format = ''
$os$directory$git_branch$git_status
$nix_shell$status$character
'';
right_format = "$all";
cmake.disabled = true;
cmd_duration = {
format = "";
show_notifications = true;
notification_timeout = 10000;
};
git_branch.format = "on [$branch(:$remote_branch)]($style) ";
git_metrics.disabled = false;
git_status = {
conflicted = "!";
up_to_date = "ok";
stashed = "S";
modified = "M";
};
directory = {
truncation_length = 3;
fish_style_pwd_dir_length = 1;
read_only = " 󰌾";
};
nix_shell.format = "[nix-shell]($style) ";
os = {
disabled = false;
style = "bold blue";
symbols = {
NixOS = " "; # Этот символ корректно отобразится только при наличии Nerd Fonts
};
};
python = {
symbol = "py ";
python_binary = ["python3" "python"];
};
status.disabled = false;
};
};
zsh = {
enable = true;
enableCompletion = true;
autosuggestion.enable = true;
syntaxHighlighting.enable = true;
shellAliases =
let
flakeDir = "~/.config/nixos";
in {
rb = "nh os switch ${flakeDir}";
upd = "nix flake update ${flakeDir}";
upg = "sudo nixos-rebuild switch --upgrade --flake ${flakeDir}";
hms = "nh home switch ${flakeDir}";
conf = "$EDITOR ${flakeDir}/nixos/hosts/$(hostname)/configuration.nix";
pkgs = "$EDITOR ${flakeDir}/nixos/packages.nix";
ll = "ls -l";
se = "sudoedit";
ff = "fastfetch";
cat = "${pkgs.lib.getExe pkgs.bat}";
cd = "z";
lg = "lazygit";
rebuild = "sudo nixos-rebuild switch --flake ~/.config/f#WhiteRaven";
deleteGenerations = "sudo nix-collect-garbage -d";
openHome = "vim .config/f/home-manager/home.nix";
rebuildHome = "home-manager switch --flake ~/.config/f";
rebuildHomeSudo = "sudo home-manager switch --flake ~/.config/f";
openConfiguration = "sudo nano ~/.config/f/nixos/hosts/usconfig/configuration.nix";
openHyprland = "vim .config/f/home-manager/data/hyprland.nix";
openZSH = "vim .config/f/home-manager/zsh.nix";
openWayBar = "vim .config/f/home-manager/data/waybar.nix";
rebuildFlake = "sudo nixos-rebuild switch --flake /home/kirill/.config/f --impure";
openFlake = "vim /home/kirill/.config/f/flake.nix";
swichWalls = "wallpaper_changer";
shell = "nix-shell . --run zsh";
testZapret = "sudo zapret-test-strategies";
charge = "sudo tlp setcharge 90 95 BAT0 && sudo tlp setcharge 90 95 BAT1 && echo 'Зарядка обеих батарей до 95% запущена (только на текущую сессию)'";
};
initContent = ''
eval "$(zoxide init zsh)"
source "$(fzf-share)/key-bindings.zsh"
source "$(fzf-share)/completion.zsh"
run() {
nix run "nixpkgs#$1"
}
'';
envExtra = ''
TERM=xterm-256color
'';
history.size = 10000;
history.path = "${config.xdg.dataHome}/zsh/history";
oh-my-zsh = {
enable = true;
plugins = [ "git" "sudo" ];
theme = "agnoster"; # blinks is also really nice
};
};
};
}