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