nix/module/common/bash/Bash.nix

61 lines
1.8 KiB
Nix
Raw Normal View History

2024-04-03 06:21:29 +03:00
{ config, ... }: let
negative-r = config.lib.stylix.colors.base08-rgb-r;
negative-g = config.lib.stylix.colors.base08-rgb-g;
negative-b = config.lib.stylix.colors.base08-rgb-b;
neutral-r = config.lib.stylix.colors.base0C-rgb-r;
neutral-g = config.lib.stylix.colors.base0C-rgb-g;
neutral-b = config.lib.stylix.colors.base0C-rgb-b;
positive-r = config.lib.stylix.colors.base0B-rgb-r;
positive-g = config.lib.stylix.colors.base0B-rgb-g;
positive-b = config.lib.stylix.colors.base0B-rgb-b;
accent-r = config.lib.stylix.colors.base0A-rgb-r;
accent-g = config.lib.stylix.colors.base0A-rgb-g;
accent-b = config.lib.stylix.colors.base0A-rgb-b;
2024-04-03 06:47:48 +03:00
2024-04-03 06:51:47 +03:00
bg = config.lib.stylix.colors.base01;
fg = config.lib.stylix.colors.base04;
2024-04-03 06:47:48 +03:00
accent = config.lib.stylix.colors.base06;
fontNamePopup = config.stylix.fonts.serif.name;
fontSizePopup = config.stylix.fonts.sizes.popups;
2024-04-03 06:21:29 +03:00
in {
config = ''
# If not running interactively, don't do anything.
[[ "$-" != *i* ]] && return
# Src system bashrc.
[[ -f /etc/bashrc ]] && source /etc/bashrc
# Define colors.
export negative_rgb="${negative-r};${negative-g};${negative-b}"
export neutral_rgb="${neutral-r};${neutral-g};${neutral-b}"
export positive_rgb="${positive-r};${positive-g};${positive-b}"
export accent_rgb="${accent-r};${accent-g};${accent-b}"
2024-04-03 06:51:47 +03:00
export bg="${bg}"
export fg="${fg}"
export accent="${accent}"
2024-04-03 06:21:29 +03:00
2024-04-03 06:47:48 +03:00
# Define font.
export font_name_popup="${fontNamePopup}"
export font_size_popup="${toString(fontSizePopup)}"
2024-04-03 06:21:29 +03:00
# Src custom modules.
for module in $BASH_PATH/module/*.sh; do
source "$module"
done
# Alias to reload.
function bashrc() {
source $BASH_PATH/Bashrc.sh
}
# Export all functions.
export -f $(find_function | tr '\n' ' ')
# Autostart Sway.
if [[ -z $DISPLAY ]] && [[ "$(tty)" = "/dev/tty1" ]]; then
exec sway
fi
'';
}