{
  pkgs,
  config,
  lib,
  ...
}:
with lib;
let
  cfg = config.eboskma.programs.fish;

  catppuccin = pkgs.fetchFromGitHub {
    owner = "catppuccin";
    repo = "fish";
    rev = "0ce27b518e8ead555dec34dd8be3df5bd75cff8e";
    hash = "sha256-Dc/zdxfzAUM5NX8PxzfljRbYvO9f9syuLO8yBr+R3qg=";
  };
in
{
  options.eboskma.programs.fish = {
    enable = mkEnableOption "Enable fish shell";
  };

  config = mkIf cfg.enable {
    programs = {
      fish = {
        enable = true;
        functions = import ./functions.nix { inherit pkgs; };

        plugins = [
          {
            name = "dracula";
            src = pkgs.fetchFromGitHub {
              owner = "dracula";
              repo = "fish";
              rev = "269cd7d76d5104fdc2721db7b8848f6224bdf554";
              hash = "sha256-Hyq4EfSmWmxwCYhp3O8agr7VWFAflcUe8BUKh50fNfY=";
            };
          }
        ];

        shellAliases = {
          ls = "${pkgs.eza}/bin/eza --long --git --git-repos --header --classify --binary";
          tree = "${pkgs.eza}/bin/eza --tree --icons";

          vimdiff = mkIf config.eboskma.programs.neovim.enable "nvim -d";
          vim = mkIf config.eboskma.programs.neovim.enable "nvim";
          vi = mkIf config.eboskma.programs.neovim.enable "nvim";
        };
        interactiveShellInit = ''
          set -Ux CARAPACE_BRIDGES 'zsh,fish,bash,inshellisense'
          ${pkgs.carapace}/bin/carapace _carapace | source
        '';
      };

      fzf = {
        enable = true;
        enableFishIntegration = true;
        changeDirWidgetCommand = "${pkgs.fd}/bin/fd -type d";
        defaultCommand = "${pkgs.fd}/bin/fd -type f";
        defaultOptions = [
          "--cycle"
          "--layout=reverse"
          "--border"
          "--height=90%"
          "--preview-window=wrap"
          "--marker='*'"
        ];
        fileWidgetCommand = "${pkgs.fd}/bin/fd -type f";
      };

      direnv = {
        enable = true;
        nix-direnv.enable = true;
      };

      zoxide = {
        enable = true;
        enableFishIntegration = true;
      };
    };

    xdg.configFile."fish/themes/Catppuccin Mocha.theme".source = "${catppuccin}/themes/Catppuccin Mocha.theme";
  };
}