69 lines
2.1 KiB
Nix

{ pkgs, lib, ... }:
let
eza = "${lib.getExe pkgs.eza} --color=always --group-directories-first";
cargo = "${lib.getExe pkgs.cargo}";
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 = {
c = cargo;
cr = "${cargo} run";
cb = "${cargo} build";
# 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'';
# aliases for (I think) macos commands
pbcopy = "${pkgs.wl-clipboard}/bin/wl-copy";
pbpaste = "${pkgs.wl-clipboard}/bin/wl-paste";
gcc-native = "${lib.getExe pkgs.gcc} -Q --help=target -mtune=native -march=native | ${lib.getExe pkgs.gnugrep} -E '^\\s+\-(mtune|march)=' | ${coreutils}/tr -d '[:blank:]'";
run-steam = "gamescope --backend sdl -W 2256 -H 1504 -f --steam -- steam -tenfoot -pipewire-dmabuf";
};
shellInit = ''
fish_add_path ~/.local/bin
fish_add_path ~/.cargo/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;
}
];
};
}