Files
nixos/home/progs/fish.nix

63 lines
1.9 KiB
Nix

# Shared fish configuration — imported from home/profiles/terminal.nix, so it
# runs on every host (mreow, yarn, muffin, and any machine using the portable
# homeConfigurations output).
#
# Desktop/dev-specific aliases (cargo, gcc, wl-clipboard) are added from the
# profile that owns their dependencies, not here.
{ pkgs, lib, ... }:
let
eza = "${lib.getExe pkgs.eza} --color=always --group-directories-first";
coreutils = "${pkgs.coreutils}/bin";
in
{
programs.fish = {
enable = true;
interactiveShellInit = ''
# disable greeting
set fish_greeting
# fixes gnupg password entry
export GPG_TTY=(${coreutils}/tty)
# pfetch on shell start (disable pkgs because of execution time)
PF_INFO="ascii title os host kernel uptime memory editor wm" ${lib.getExe pkgs.pfetch-rs}
'';
shellAliases = {
# from DistroTube's dot files: Changing "ls" to "eza"
ls = "${eza} -al";
la = "${eza} -a";
ll = "${eza} -l";
lt = "${eza} -aT";
# gets the largest files in a git repo's history
"git-size" = ''
${lib.getExe pkgs.git} rev-list --objects --all |
${lib.getExe pkgs.git} cat-file --batch-check='%(objecttype) %(objectname) %(objectsize) %(rest)' |
${lib.getExe pkgs.gnused} -n 's/^blob //p' |
${coreutils}/sort --numeric-sort --key=2 |
${coreutils}/cut -c 1-12,41- |
${coreutils}/numfmt --field=2 --to=iec-i --suffix=B --padding=7 --round=nearest'';
};
shellInit = ''
fish_add_path ~/.local/bin
fish_add_path ~/.cargo/bin
fish_add_path ~/.config/emacs/bin
set hydro_color_pwd 62A
set hydro_color_error red
set hydro_color_duration yellow
set hydro_color_prompt green
set hydro_color_git blue
'';
plugins = [
{
name = "hydro";
src = pkgs.fishPlugins.hydro.src;
}
];
};
}