ENH only install emacs packages when needed

DEL haskell emacs deps (don't need them anymore)
This commit is contained in:
Nathan Dwarshuis 2021-03-13 22:19:27 -05:00
parent 02b41252f4
commit 6a1d9c342b
2 changed files with 12 additions and 25 deletions

View File

@ -63,17 +63,19 @@ run_yay() {
## packages for emacs (install emacs first to read the config)
pacman --needed -S emacs
# call emacs once to initialize it
sudo -u "$home_user" emacs -batch -l "$emacs_dir/init.el"
# get a list of packages emacs needs
sudo -u "$home_user" emacs -batch -l "$emacs_dir/init.el" --eval \
'(print (format "pkgs: %s" (s-join " " (nd/get-aur-dependencies t))))'
if sudo -u "$home_user" emacs -batch -l "$emacs_dir/init.el"; then
IFS=' ' read -r -a emacs_pkgs \
< <(sudo -u "$home_user" emacs -batch -l "$emacs_dir/init.el" --eval \
'(print (format "pkgs: %s" (s-join " " (nd/get-aur-dependencies t))))' \
2>/dev/null | \
sed -n -e 's/"pkgs: \(.*\)"/\1/p')
echo "Emacs requires the following system pkgs: ${emacs_pkgs[*]}"
else
echo "Could not get list of emacs dependencies. Install them later."
emacs_pkgs=()
fi
## other packages for random gizmos
dunst_pkgs=(dunst)

View File

@ -46,21 +46,6 @@ clone_maybe https://github.com/ndwarshuis/.emacs.d.git "$emacs_dir"
sudo "$HOME/.bin/bootstrap_pkgs" "$(whoami)" "$HOME/.local/share/packages" "$emacs_dir"
# Install Haskell dependencies for emacs. This is only necessary because some
# Haskell programs are not packaged as "bin" or "stack" packages, in which case
# arch will pull in a bunch of crap because dynamic linking
IFS=' ' read -r -a emacs_stack_pkgs \
< <(emacs -batch -l "$emacs_dir/init.el" --eval \
'(print (format "pkgs: %s" (s-join " " (nd/get-stack-dependencies))))' \
2>/dev/null | \
sed -n -e 's/"pkgs: \(.*\)"/\1/p')
echo "Emacs requires the following Haskell packages: ${emacs_stack_pkgs[*]}"
for p in "${emacs_stack_pkgs[@]}";
do
stack install "$p"
done
## CLONE/BUILD HASKELL-BASED REPOS
# TODO not dry (this is in .pam_environment)