nix-dotfiles/hmModules/apps/fish/app.nix

47 lines
1.2 KiB
Nix
Raw Permalink Normal View History

2025-05-22 09:04:33 -07:00
{ config, lib, pkgs, ... }:
2024-04-21 01:43:11 -07:00
let
functionModule = with lib.types; submodule {
options = {
body = lib.mkOption { type = lines; };
wraps = lib.mkOption {
type = nullOr str;
default = null;
};
};
};
in {
2024-04-14 05:40:02 -07:00
options.fish = {
enable = lib.mkEnableOption "Enables fish";
extraFunctions = lib.mkOption {
2024-04-21 01:43:11 -07:00
type = with lib.types; attrsOf (either lines functionModule);
default = {};
};
2024-04-14 05:40:02 -07:00
};
config = lib.mkIf config.fish.enable {
programs.fish = {
enable = true;
2025-05-22 09:04:33 -07:00
interactiveShellInit = ''
${pkgs.nix-your-shell}/bin/nix-your-shell fish | source
'';
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
};
};
}