{
  config,
  pkgs,
  lib,
  ...
}: let
in {
  imports = [
    ./helix.nix
    # ./nnn.nix
    # ./tmux.nix
    ./zellij.nix
    ./xplr.nix
  ];

  home.packages = with pkgs; [
    ripgrep
    ripgrep-all
    file
    openssh
  ];
  home.stateVersion = "22.05";

  programs.home-manager.enable = true;
  programs.direnv.enable = true;
  programs.exa.enable = true;
  programs.bat.enable = true;
  programs.nix-index.enable = true;
  programs.fzf.enable = true;
  programs.ssh.enable = true;
  programs.atuin = {
    enable = true;
    settings = {
      style = "compact";
    };
  };

  programs.nushell = {
    enable = true;
    envFile.text = ''
      zoxide init nushell | save -f ~/.zoxide.nu
    '';
    configFile.text = ''
      source ~/.zoxide.nu

      def l [glob: string = ""] {
        ls -la $glob | sort-by type | select mode size modified name target
      }
    '';
  };

  programs.fish = {
    enable = true;
    shellAliases = {
      l = "exa -lah --group-directories-first --icons";
      sus = "systemctl suspend";
      cat = "bat";
    };
    shellAbbrs = {
      ns = "nix shell";
      nss = "nix search";
      flake-update = "nix flake lock --update-input";
      vim = "hx";
    };
    functions = {
      fish_prompt = {
        body = builtins.readFile ./prompt.fish;
      };
      __cd_hook = {
        body = "l";
        onVariable = "PWD";
      };
      load-env-file = {
        body = ''
          for v in (grep -v "^\s*#" $argv[1])
            set -gx (echo -n $v | tr = \n)
          end
        '';
      };
    };
    interactiveShellInit = let
      gpgAgentInit = lib.optionalString pkgs.stdenv.isDarwin ''
        # Initialize GPG agent
        gpgconf --launch gpg-agent
        set -gx GPG_TTY (tty)
        set -gx SSH_AUTH_SOCK (gpgconf --list-dirs agent-ssh-socket)
      '';
    in ''
      # Argument abbrs because home-manager doesn't support them
      abbr -ag --position anywhere -- ifc '--inputs-from ${../.}'

      # Emacs TRAMP integration
      if test "$TERM" = "dumb"
        function fish_prompt
          echo "\$ "
        end

        function fish_right_prompt; end
        function fish_greeting; end
        function fish_title; end
      end

      # Initialize hooks
      __cd_hook > /dev/null

      ${gpgAgentInit}
    '';
  };

  programs.zoxide = {
    enable = true;
  };

  programs.git = {
    enable = true;
    userName = "Nikodem Rabuliński";
    userEmail = lib.mkDefault "nikodem@rabulinski.com";
    delta.enable = true;
    signing = {
      key = lib.mkDefault "FF629AA9E08138DB";
      signByDefault = true;
    };
    extraConfig = {
      push.followTags = true;
    };
  };

  programs.gpg = {
    enable = true;
    settings = {default-key = "FF629AA9E08138DB";};
  };

  services.gpg-agent = {
    enable = lib.mkDefault pkgs.hostPlatform.isLinux;
    enableSshSupport = true;
    pinentryFlavor = "tty";
    sshKeys = ["81CC27083653861F657A23280C32A9B41DAEF9A0"];
  };
}