52 lines
1.0 KiB
Nix
Raw Normal View History

2025-05-04 02:47:36 +02:00
{
config,
lib,
...
}:
with lib; let
cfg = config.modules.bash;
in {
options.modules.bash = {
2025-05-25 22:41:23 +02:00
enable = mkEnableOption "Enables bash";
aliases = mkOption {
2025-05-04 02:47:36 +02:00
type = types.attrsOf types.str;
default = {};
example = {
cp = "cp -i";
lns = "ln -si";
};
};
2025-05-25 22:41:23 +02:00
eatIntegration = mkEnableOption "Enable Emacs Eat integration";
bashrcExtra = mkOption {
2025-05-04 02:47:36 +02:00
type = types.lines;
default = "";
};
};
2025-05-25 22:41:23 +02:00
config = mkIf cfg.enable {
2025-05-04 02:47:36 +02:00
programs.bash = {
enable = true;
2025-05-25 22:41:23 +02:00
# inherit (cfg) bashrcExtra;
bashrcExtra =
concatLines
[
(strings.optionalString cfg.eatIntegration ''[ -n "$EAT_SHELL_INTEGRATION_DIR" ] && source "$EAT_SHELL_INTEGRATION_DIR/bash"'')
cfg.bashrcExtra
];
2025-05-04 02:47:36 +02:00
shellAliases = cfg.aliases;
shellOptions = [
"histappend"
"cmdhist"
"lithist"
"checkwinsize"
"extglob"
"globstar"
"checkjobs"
"autocd"
"cdspell"
"dirspell"
];
};
};
}