nix/home/program/bash/default.nix

39 lines
1 KiB
Nix
Raw Normal View History

{ util, pkgs, ... } @args: let
modules = util.catText (util.ls ./module) args;
modulesFile = pkgs.writeText "BashModules" modules;
in {
inherit modules modulesFile;
bashrc = modules + util.trimTabs ''
# 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/().*//"
}
# Export all functions.
export -f $(find_function | tr '\n' ' ')
export -f find_function
# Autostart Sway.
if [[ -z $DISPLAY ]] && [[ "$(tty)" = "/dev/tty1" ]]; then
exec sway
fi
'';
2024-07-01 08:15:31 +03:00
# bash_profile = util.trimTabs ''
# # Home manager.
# [ -e ~/.nix-profile/etc/profile.d/nix.sh ] && source ~/.nix-profile/etc/profile.d/nix.sh
2024-07-01 08:15:31 +03:00
# # Bashrc.
# [ -f ~/.bashrc ] && source ~/.bashrc
2024-07-01 08:15:31 +03:00
# # Profile.
# [ -f ~/.profile ] && source ~/.profile
# '';
2024-07-01 08:15:31 +03:00
# profile = util.trimTabs ''
# # Load HM vars.
# [ -e ~/.nix-profile/etc/profile.d/hm-session-vars.sh ] && source ~/.nix-profile/etc/profile.d/hm-session-vars.sh
# '';
}