nixos-config/nixos/home/packages/tools/shell.nix
2025-04-27 18:22:41 +02:00

75 lines
2.0 KiB
Nix

{
lib,
config,
pkgs,
userSettings,
...
}: let
shellAliases = {
ls = "${pkgs.eza}/bin/eza --icons";
ll = "${pkgs.eza}/bin/eza -alh --icons";
l = "${pkgs.eza}/bin/eza -lh --icons=auto";
tree = "${pkgs.eza}/bin/eza --tree --icons";
neofetch = "${pkgs.fastfetch}/bin/fastfetch";
open = "xdg-open";
ip = "ip -c";
s = "kitten ssh";
icat = "kitten icat";
diff = "diff --color";
respawn = "clear; ${pkgs.pfetch}/bin/pfetch";
mkdir = "mkdir -p";
cat = "${pkgs.bat}/bin/bat --style plain";
rasp = "s masaoka";
hist = "history | awk '{for (i=2; i<=NF; i++) printf \$i\" \"; print \"\"}' | fzf | wl-copy";
cdx = "${pkgs.zoxide}/bin/zoxide query --interactive";
#distrobox-enter = "distrobox-enter --root";
#distrobox-create = "distrobox-create --root";
#distrobox-list = "distrobox-list --root";
};
in {
options = {
sh.bash.enable = lib.mkEnableOption "enables shell bash";
sh.zsh.enable = lib.mkEnableOption "enables shell zsh";
};
config = lib.mkMerge [
(lib.mkIf config.sh.bash.enable {
programs.bash = {
enable = true;
enableCompletion = true;
inherit shellAliases;
bashrcExtra =
if userSettings.hostname != "ginoza"
then ''
TERM=xterm-256color
${pkgs.pfetch}/bin/pfetch''
else ''TERM=xterm-256color'';
};
home.sessionVariables = {
XDG_DATA_HOME = "$HOME/.local/share";
XDG_PICTURES_DIR = "$HOME/Pictures/Screenshots/";
};
})
(lib.mkIf config.sh.zsh.enable {
programs.zsh = {
enable = true;
enableCompletion = true;
autosuggestion.enable = true;
syntaxHighlighting.enable = true;
shellAliases = shellAliases;
initExtra = ''
${pkgs.pfetch}/bin/pfetch
set -o emacs
bindkey "^[[3~" delete-char
TERM=xterm-256color
PKG_CONFIG_PATH="${pkgs.openssl.dev}/lib/pkgconfig"
'';
};
})
];
}