flake/homes/modules/fish.nix
2026-02-08 18:56:06 +10:00

85 lines
2.2 KiB
Nix
Executable file

{
config,
lib,
pkgs,
...
}: {
options = {
morphBashToFish = lib.mkEnableOption "morphBashToFish";
};
# TODO: make the greeting controllable (ie so my VPS can be different)
config = {
programs.fish = {
enable = true;
generateCompletions = true;
# vendor = {
# config.enable = true;
# functions.enable = true;
# completions.enable = true;
# };
interactiveShellInit = let
greetings =
[
"Welcome weary traveller to my shop"
"It's dangerous to go alone! Take this."
"Do butterflies cry when they're sad?"
"I hope they do"
"I think Alice is lost..."
"Something wicked this way comes"
"May your L's be many... and your bitches few"
"What a horrible night to have a curse."
"The ancient spirits of light and dark have been released."
"The god of the stars rejects your offering. The ritual can only be performed at night."
"You should have just died..."
"Supreme Witch, Calamitas has killed every player!"
]
|> map (x: "\"${x}\"")
|> builtins.concatStringsSep " ";
in ''
# add dotnet completions if it exists (ie we're in a virtual environment)
if type -q dotnet
complete -f -c dotnet -a "(dotnet complete (commandline -cp))"
end
function rand_greet
set greetings ${greetings}
echo -n $greetings[(random 1 (count $greetings))]
end
function gitignore -a type
curl -sL "https://www.gitignore.io/api/$type"
end
# ripgrep on files
function rgf
rg --files | rg $args
end
set -g fish_greeting (rand_greet)
'';
shellAliases = {
brip = "batgrep"; # bat + ripgrep
man = "batman"; # bat + man
ls = "eza --color=auto";
l = "eza -Alh --color=auto --icons=auto";
ll = "eza -lh --color=auto --icons=auto";
li = "eza --color=auto --git-ignore";
};
plugins = [
{
name = "grc";
src = pkgs.fishPlugins.grc.src;
}
];
};
};
}