2024-12-18 10:54:24 +03:00
|
|
|
{
|
|
|
|
util,
|
|
|
|
pkgs,
|
|
|
|
secret,
|
|
|
|
config,
|
|
|
|
...
|
|
|
|
}:
|
2024-12-18 09:40:11 +03:00
|
|
|
let
|
2024-12-18 10:54:24 +03:00
|
|
|
accent = "${config.module.style.color.accentR};${config.module.style.color.accentG};${config.module.style.color.accentB}";
|
|
|
|
negative = "${config.module.style.color.negativeR};${config.module.style.color.negativeG};${config.module.style.color.negativeB}";
|
|
|
|
neutral = "${config.module.style.color.neutralR};${config.module.style.color.neutralG};${config.module.style.color.neutralB}";
|
|
|
|
positive = "${config.module.style.color.positiveR};${config.module.style.color.positiveG};${config.module.style.color.positiveB}";
|
|
|
|
|
|
|
|
tgbot = secret.tg.bt;
|
|
|
|
tgdata = secret.tg.dt "false";
|
|
|
|
tgdatasilent = secret.tg.dt "true";
|
|
|
|
|
2024-12-18 11:13:33 +03:00
|
|
|
modulesRaw = pkgs.writeText "bash-user-modules-raw" (util.readFiles (util.ls ./module));
|
2024-12-18 10:54:24 +03:00
|
|
|
modulesFile = pkgs.replaceVars modulesRaw {
|
|
|
|
inherit
|
|
|
|
accent
|
|
|
|
negative
|
|
|
|
neutral
|
|
|
|
positive
|
|
|
|
tgbot
|
|
|
|
tgdata
|
|
|
|
tgdatasilent
|
|
|
|
;
|
|
|
|
};
|
2024-12-18 09:40:11 +03:00
|
|
|
in
|
2024-10-11 23:27:07 +03:00
|
|
|
{
|
2024-12-18 10:54:24 +03:00
|
|
|
inherit modulesFile;
|
2024-06-30 03:56:48 +03:00
|
|
|
|
2024-12-18 09:40:11 +03:00
|
|
|
bashrc =
|
2024-12-18 10:54:24 +03:00
|
|
|
(builtins.readFile modulesFile)
|
2024-12-18 09:40:11 +03:00
|
|
|
+ ''
|
|
|
|
# Find all functions.
|
|
|
|
function find_function() {
|
|
|
|
/usr/bin/env cat ${modulesFile} | /usr/bin/env grep "^function.*()" | /usr/bin/env sed -e "s/^function //" -e "s/().*//"
|
|
|
|
}
|
2024-06-30 03:56:48 +03:00
|
|
|
|
2024-12-18 09:40:11 +03:00
|
|
|
# Export all functions.
|
|
|
|
export -f $(find_function | tr '\n' ' ')
|
|
|
|
export -f find_function
|
2024-06-30 03:56:48 +03:00
|
|
|
|
2024-12-18 09:40:11 +03:00
|
|
|
# Autostart Sway.
|
|
|
|
if [[ -z $DISPLAY ]] && [[ "$(tty)" = "/dev/tty1" ]]; then
|
|
|
|
exec sway
|
|
|
|
fi
|
|
|
|
'';
|
2024-06-30 03:56:48 +03:00
|
|
|
|
2024-12-18 09:40:11 +03:00
|
|
|
# bash_profile = ''
|
|
|
|
# # Home manager.
|
|
|
|
# [ -e ~/.nix-profile/etc/profile.d/nix.sh ] && source ~/.nix-profile/etc/profile.d/nix.sh
|
2024-06-30 03:56:48 +03:00
|
|
|
|
2024-12-18 09:40:11 +03:00
|
|
|
# # Bashrc.
|
|
|
|
# [ -f ~/.bashrc ] && source ~/.bashrc
|
2024-06-30 03:56:48 +03:00
|
|
|
|
2024-12-18 09:40:11 +03:00
|
|
|
# # Profile.
|
|
|
|
# [ -f ~/.profile ] && source ~/.profile
|
|
|
|
# '';
|
2024-06-30 03:56:48 +03:00
|
|
|
|
2024-12-18 09:40:11 +03:00
|
|
|
# profile = ''
|
|
|
|
# # Load HM vars.
|
|
|
|
# [ -e ~/.nix-profile/etc/profile.d/hm-session-vars.sh ] && source ~/.nix-profile/etc/profile.d/hm-session-vars.sh
|
|
|
|
# '';
|
2024-06-30 03:56:48 +03:00
|
|
|
}
|