2024-04-14 05:40:02 -07:00
|
|
|
{ config, pkgs, lib, ... }:
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
options.fish = {
|
|
|
|
|
enable = lib.mkEnableOption "Enables fish";
|
2024-04-21 01:19:38 -07:00
|
|
|
extraFunctions = lib.mkOption {
|
|
|
|
|
type = with lib.types; attrsOf lines;
|
|
|
|
|
default = {};
|
|
|
|
|
};
|
2024-04-14 05:40:02 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
config = lib.mkIf config.fish.enable {
|
2024-04-21 01:19:38 -07:00
|
|
|
programs.fish = {
|
|
|
|
|
enable = true;
|
|
|
|
|
functions = {
|
|
|
|
|
fish_greeting = "";
|
|
|
|
|
fish_prompt = ''
|
|
|
|
|
if test $status -eq 0
|
|
|
|
|
echo -n -s (set_color blue -o) τ " " (set_color normal)
|
|
|
|
|
else
|
|
|
|
|
echo -n -s (set_color red -o) τ " " (set_color normal)
|
|
|
|
|
end
|
|
|
|
|
'';
|
|
|
|
|
fish_right_prompt = ''
|
|
|
|
|
git_prompt
|
|
|
|
|
echo -n -s (set_color blue) (prompt_pwd) " "
|
|
|
|
|
echo -n -s (set_color yellow) $CMD_DURATION ms
|
|
|
|
|
echo -n -s (set_color normal)
|
|
|
|
|
'';
|
|
|
|
|
git_prompt = ''${builtins.readFile ./functions/git_prompt.fish}'';
|
|
|
|
|
} // config.fish.extraFunctions;
|
2024-04-14 05:40:02 -07:00
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
}
|