{ config, lib, pkgs, ... }:

let
  cfg = config.sydnix.users.crumb.bash;
in {
  options.sydnix.users.crumb.bash.enable = lib.mkEnableOption "Bash, à la crumb";
  config = lib.mkIf cfg.enable {
    programs.bash = {
      enable = true;
      shellOptions = [
        # Correct minor typos in cd commands.
        "cdspell"
        "autocd"
        # Extra glob power.
        "extglob"
        # Recursive glob w/ **.
        "globstar"
        # Append to history file.
        "histappend"
        # Require user confirmation for commands using expansion.
        "histverify"
        # Re-edit failed history substitutions.
        "histreedit"
      ];
    };

    home.shellAliases = {
      nix2json = "nix eval --impure --json --file -";
      "..." = "cd ../..";
      "...." = "cd ../../..";
    };
  };
}
  
