Prefer stow over hand-rolled solution
After discovering GNU stow on Nix IRC, refactored install and setup scripts to consume it. Code is vastly simplified as a result.
This commit is contained in:
parent
e8ca641075
commit
a86c2ddece
10 changed files with 42 additions and 56 deletions
|
@ -1,47 +1,11 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
dotfiles_path="${HOME}/dotfiles"
|
||||
configs_dir="${dotfiles_path}/configs"
|
||||
shared_configs="${configs_dir}/shared"
|
||||
configs="$HOME/dotfiles/configs"
|
||||
|
||||
if [[ $(uname) == 'Darwin' ]]; then
|
||||
os_specific_configs="${configs_dir}/os_x"
|
||||
(cd "$configs/os_x" && stow --target="$HOME" *)
|
||||
elif [[ $(uname) == 'Linux' ]]; then
|
||||
os_specific_configs="${configs_dir}/linux"
|
||||
(cd "$configs/linux" && stow --target="$HOME" *)
|
||||
fi
|
||||
|
||||
|
||||
function symlink_configs () {
|
||||
configs_dir=$1
|
||||
|
||||
for cf in $(find $configs_dir -type f -name ".*"); do
|
||||
filename=$(grep -o "[^\/]+$" <<<$cf)
|
||||
echo "$filename: "
|
||||
|
||||
if [ -f "${HOME}/${filename}" ] && [ ! -L "${HOME}/${filename}" ]; then
|
||||
echo -n "Backing up ${filename}... " && \
|
||||
mv "${HOME}/${filename}" "${HOME}/${filename}.bak" && \
|
||||
echo "Done."
|
||||
fi
|
||||
|
||||
if [ -L "${HOME}/${filename}" ]; then
|
||||
if [ $(readlink "${HOME}/${filename}") = $cf ]; then
|
||||
echo "Already properly symlinked to ${configs_dir}."
|
||||
else
|
||||
echo "Already symlinked but NOT to the proper location. Aborting..."
|
||||
fi
|
||||
else
|
||||
echo -n "Symlinking to ${filename}... " && \
|
||||
ln -s $cf "${HOME}/${filename}" && \
|
||||
echo "Done."
|
||||
fi
|
||||
echo ""
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
# handle shared configs
|
||||
symlink_configs $shared_configs
|
||||
|
||||
# handle os-specific configs
|
||||
symlink_configs $os_specific_configs
|
||||
(cd "$configs/shared" && stow --target="$HOME" *)
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
-- Useful Typeclasses
|
||||
import Control.Applicative
|
||||
import Data.Monoid
|
||||
|
||||
-- Data Structures
|
||||
import qualified Data.Map.Internal as Map
|
||||
|
||||
-- Lenses
|
||||
import qualified Control.Lens as Lens
|
||||
import qualified Control.Lens.Traversal as Lens
|
||||
|
||||
-- Friendly prompt
|
||||
:set prompt "\ESC[34mλ> \ESC[m"
|
32
configs/shared/haskell/.ghci
Normal file
32
configs/shared/haskell/.ghci
Normal file
|
@ -0,0 +1,32 @@
|
|||
-- Useful Typeclasses
|
||||
import Control.Applicative
|
||||
import Data.Monoid
|
||||
|
||||
-- Data Structures
|
||||
import qualified Data.Map.Internal as Map
|
||||
|
||||
-- Lenses
|
||||
import Control.Lens
|
||||
import qualified Control.Lens as Lens
|
||||
import qualified Control.Lens.Traversal as Lens
|
||||
|
||||
-- Friendly prompt
|
||||
:set prompt "\ESC[34mλ> \ESC[m"
|
||||
|
||||
-- GHCi on Acid
|
||||
:m - Prelude
|
||||
:m + GOA
|
||||
setLambdabotHome "/Users/wpcarro/Haskell/bin"
|
||||
:def bs lambdabot "botsnack"
|
||||
:def pl lambdabot "pl"
|
||||
:def unpl lambdabot "unpl"
|
||||
:def redo lambdabot "redo"
|
||||
:def undo lambdabot "undo"
|
||||
:def index lambdabot "index"
|
||||
:def docs lambdabot "docs"
|
||||
:def instances lambdabot "instances"
|
||||
:def hoogle lambdabot "hoogle"
|
||||
:def source lambdabot "fptools"
|
||||
:def where lambdabot "where"
|
||||
:def version lambdabot "version"
|
||||
:def src lambdabot "src"
|
|
@ -3,6 +3,9 @@ export DOTFILES="${HOME}/dotfiles"
|
|||
export ZSH="${HOME}/.oh-my-zsh"
|
||||
export PATH="${PATH}:${HOME}/.local/bin"
|
||||
|
||||
# Put this here temporarily until we have a better place for it.
|
||||
export FPP_EDITOR='emacsclient -n'
|
||||
|
||||
ZSH_THEME=refined
|
||||
plugins=(zsh-autosuggestions git git-extras github)
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env zsh
|
||||
#!/usr/bin/env bash
|
||||
|
||||
source "${DOTFILES}/configs/setup"
|
||||
ln -s "${DOTFILES}/emacs.d" "${HOME}/.emacs.d"
|
||||
source "$HOME/dotfiles/configs/setup"
|
||||
ln -s "$DOTFILES/emacs.d" "$HOME/.emacs.d"
|
||||
|
|
Loading…
Reference in a new issue