spacemacs, stow

This commit is contained in:
Andrejus
2021-04-26 23:25:43 +01:00
parent 75c7cd09db
commit 31f3fe9064
25 changed files with 632 additions and 56 deletions

View File

@@ -27,7 +27,7 @@ function bin_in_path {
# @arg $1 apt package to test
function apt_installed {
dpkg --status $1
dpkg --status $1 >/dev/null
}
function clean {
@@ -65,3 +65,23 @@ function add_repository {
function install_file {
sudo apt-get install -qqf $(cat $1)
}
# @arg $1 JSON object containing the following keys
# * name - apt repository
# * target - gpg signing key url
function stow_package {
name=$(jq -r ".name" <<<"$1")
target=$(jq -r ".target" <<<"$1")
case $target in
HOME)
rm $HOME/.bashrc || true
rm $HOME/.profile || true
target=$HOME
;;
*)
;;
esac
sudo stow --dir="$ABS_DIR/files" --target=$target $name
}

View File

@@ -1,17 +0,0 @@
#!/usr/bin/env bash
set -eo pipefail
#
# Script that stows all tracked dotfiles into the user's home directory.
#
REL_DIR=`dirname "$0"`
ABS_DIR=`readlink -f $REL_DIR/../` # Scripts are nested inside of /scripts
# TODO
# Migrate to config.fish
rm $HOME/.bashrc
rm $HOME/.profile
echo "Stowing $ABS_DIR to $HOME"
stow --dir=$ABS_DIR --target=$HOME files

View File

@@ -1,7 +1,8 @@
#!/usr/bin/env bash
fish --version
current_shell=`readlink -f /proc/$$/exe`
current_shell=`grep "^$USER" /etc/passwd`
current_shell=${current_shell##*:}
fish_shell=`which fish`
if [[ "$current_shell" != "$fish_shell" ]]; then
chsh -s "$fish_shell"

View File

@@ -8,7 +8,8 @@ fi
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
nvm --version
nvm install node
nvm use node
nvm alias default lts/fermium
nvm install lts/fermium
nvm use lts/fermium
node --version

View File

@@ -0,0 +1,4 @@
#!/usr/bin/env bash
if [ ! -d ~/.emacs.d ]; then
git clone https://github.com/syl20bnr/spacemacs ~/.emacs.d
fi

View File

@@ -22,7 +22,7 @@ LOG_DIR="${ABS_DIR}/logs"
mkdir -p "$LOG_DIR"
LOG_TARGET=${LOG_TARGET:-"${LOG_DIR}/${UUID}.log"}
main() {
install() {
echo "Running $NAME at $TIME"
echo "Running as $USER on $HOST"
@@ -53,8 +53,11 @@ main() {
done
# Install dotfiles on system and load them
figlet -c "Bootstrapping..."
$ABS_DIR/scripts/bootstrap.sh
figlet -c "Stowing..."
for i in $(jq ".stow_packages | keys | .[]" "$CONFIG"); do
value=$(jq -r ".stow_packages[$i]" "$CONFIG")
stow_package "$value"
done
source "$HOME/.profile"
# Run custom installer scripts
@@ -65,5 +68,5 @@ main() {
done
}
echo "main: Logging to $LOG_TARGET"
main 2>&1 | tee "$LOG_TARGET"
echo "install: Logging to $LOG_TARGET"
install 2>&1 | tee "$LOG_TARGET"

View File

@@ -45,9 +45,11 @@
"devscripts",
"docker-ce",
"docker-ce-cli",
"emacs",
"fd-find",
"figlet",
"fish",
"fonts-nanum",
"fortune-mod",
"google-cloud-sdk",
"git",
@@ -67,7 +69,9 @@
],
"node_dependencies": [
"firebase-tools",
"neovim"
"neovim",
"typescript",
"typescript-language-server"
],
"pip_dependencies": [
"awscli",
@@ -76,5 +80,11 @@
"poetry",
"python-language-server[all]",
"pyvim"
],
"stow_packages": [
{
"name": "home",
"target": "HOME"
}
]
}