aboutsummaryrefslogtreecommitdiffstats
path: root/modules/shell/bash/default.nix
blob: b845cedbee0175deaff5bb937ba3d31fea4b626c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
{ config, lib, pkgs, ... }:

{
	options.shell.bash = {
		enable = lib.mkOption {
			type = lib.types.bool;
			description = "Enables bash.";
			default = true;
		};
	};

	config = lib.mkIf config.shell.bash.enable {
		shell.default = lib.mkDefault "bash";
		shell.command =
			lib.mkIf
				(config.shell.default == "bash")
				"${pkgs.zsh}/bin/bash";

		programs.bash.enable = true;
		programs.bash.historyFile = "${config.xdg.cacheHome}/bash/history";
		programs.bash.shellAliases = config.shell.alias;
		programs.bash.bashrcExtra = ''
${if config.tools.utils.fzf.enable then
	"eval \"$(fzf --bash)\""
else ""}
		'';

		home.activation.createBashCacheDirectory =
			lib.hm.dag.entryAfter
				[ "writeBoundary" ]
				"mkdir -p ${config.xdg.cacheHome}/bash";
	};
}