72 lines
2.2 KiB
Nix

{ pkgs, ... }:
let
eza = "${pkgs.eza}/bin/eza --color=always --group-directories-first";
cargo = "${pkgs.cargo}/bin/cargo";
coreutil = "${pkgs.coreutils}/bin";
in
{
programs.fish = {
enable = true;
interactiveShellInit = ''
#disable greeting
set fish_greeting
#fixes gnupg password entry
export GPG_TTY=(${coreutil}/tty)
#pfetch on shell start (disable pkgs because of execution time)
PF_INFO="ascii title os host kernel uptime memory editor wm" ${pkgs.pfetch-rs}/bin/pfetch
'';
shellAliases = {
c = cargo;
cr = "${cargo} run";
cb = "${cargo} build";
# I hate the red background
run0 = "run0 --background=\"\"";
# 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" = ''
${pkgs.git}/bin/git rev-list --objects --all |
${pkgs.git}/bin/git cat-file --batch-check='%(objecttype) %(objectname) %(objectsize) %(rest)' |
${pkgs.gnused}/bin/sed -n 's/^blob //p' |
${coreutil}/sort --numeric-sort --key=2 |
${coreutil}/cut -c 1-12,41- |
${coreutil}/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";
nix-cleanup = "doas nix-collect-garbage --delete-older-than 1d && doas nix-store --optimise && doas nix-store --gc";
gcc-native = "${pkgs.gcc}/bin/gcc -Q --help=target -mtune=native -march=native | ${pkgs.gnugrep}/bin/grep -E '(mtune|march)=' | ${pkgs.gnugrep}/bin/grep -v 'Known valid arguments' | ${pkgs.gnused}/bin/sed -E \"s/[[:space:]]+//g\"";
};
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;
}
];
};
}