{ config, pkgs, lib, ... }: let cfg = config.ctucxConfig.programs.bash; in { options = { ctucxConfig.programs.bash = { enable = lib.mkEnableOption "bash"; }; }; config = lib.mkIf cfg.enable { ctucxConfig.programs = { starship.enable = true; mcfly.enable = true; eza.enable = true; }; home-manager.users.katja = { programs = { bash = { enable = true; enableVteIntegration = lib.mkIf pkgs.stdenv.isLinux true; historyFileSize = 999999; historyControl = [ "ignoredups" "ignorespace" ]; historyIgnore = [ "ls" "clear" "exit" ]; shellAliases = { ".." = "cd .."; "..." = "cd ../.."; rm = "rm -i"; cat = lib.mkIf (builtins.elem "bat" config.home-manager.users.katja.home.packages) "bat -p"; grep = lib.mkIf (builtins.elem "rg" config.home-manager.users.katja.home.packages) "rg"; find = lib.mkIf (builtins.elem "rd" config.home-manager.users.katja.home.packages) "fd"; diff = "diff --color"; killall = "pkill"; reinitgit = "rm -rf .git && git init && git add -A && git commit -m 'init'"; zzz = ( if pkgs.stdenv.isLinux then "sleep 1 && systemctl suspend" else "pmset sleepnow" ); backgrounditems = "bgiparser -f \"\$HOME/Library/Application Support/com.apple.backgroundtaskmanagementagent/backgrounditems.btm\" -c"; }; bashrcExtra = '' use() { declare -a all for p in "$@"; do all+=("''${NIXPKGS_PATH}#$p") done eval nix shell ''${all[@]} } '' + lib.optionalString pkgs.stdenv.isDarwin '' if [ "$TERM" != "dumb" ]; then source "${pkgs.bash-completion}/etc/profile.d/bash_completion.sh" nullglobStatus=$(shopt -p nullglob) shopt -s nullglob for p in $NIX_PROFILES; do for m in "$p/etc/bash_completion.d/"*; do source $m done done eval "$nullglobStatus" unset nullglobStatus p m fi # Make bash check its window size after a process completes shopt -s checkwinsize ${if pkgs.system == "aarch64-darwin" then '' eval "$(/opt/homebrew/bin/brew shellenv)" '' else '' eval "$(/usr/local/bin/brew shellenv)" ''} ''; }; }; }; }; }