From 38c1fff492f7fb3fc113280d3fe4fb95a98946be Mon Sep 17 00:00:00 2001 From: martinabeleda Date: Fri, 24 May 2024 15:57:00 -0700 Subject: [PATCH] switch install.sh file to dotbot --- .github/workflows/build.yaml | 16 +++++++++++ .gitmodules | 4 +++ README.md | 6 ++++- dotbot | 1 + install | 15 +++++++++++ install.conf.yaml | 18 +++++++++++++ install.sh | 51 ------------------------------------ zsh/.zshrc | 3 ++- 8 files changed, 61 insertions(+), 53 deletions(-) create mode 100644 .github/workflows/build.yaml create mode 100644 .gitmodules create mode 160000 dotbot create mode 100755 install create mode 100644 install.conf.yaml delete mode 100755 install.sh diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..70e35f9 --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,16 @@ +name: CI +on: + push: + pull_request: + schedule: + - cron: "0 8 * * 6" +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - run: | + mkdir -p ~/dotfiles-install-dir + mkdir -p ~/dotfiles-install-dir/.config + - run: | + HOME=~/dotfiles-install-dir ./install diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..1af14d0 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,4 @@ +[submodule "dotbot"] + path = dotbot + url = https://github.com/anishathalye/dotbot + ignore = dirty diff --git a/README.md b/README.md index 52af9fb..62e7701 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # dotfiles +![main workflow](https://github.com/martinabeleda/dotfiles/actions/workflows/build.yaml/badge.svg) + A collection of my configuration and dotfiles for easy setup ## :construction: setup @@ -14,9 +16,11 @@ cd dotfiles Link all dotfiles and install plugins: ```shell -./install.sh +./install ``` +This is managed by [dotbot](https://github.com/anishathalye/dotbot) + Install mac developer tools **without** installing XCode: ```shell diff --git a/dotbot b/dotbot new file mode 160000 index 0000000..7202065 --- /dev/null +++ b/dotbot @@ -0,0 +1 @@ +Subproject commit 720206578a8daf1e7167200e73e314fc4b8af52e diff --git a/install b/install new file mode 100755 index 0000000..5a7e72c --- /dev/null +++ b/install @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +set -e + +CONFIG="install.conf.yaml" +DOTBOT_DIR="dotbot" + +DOTBOT_BIN="bin/dotbot" +BASEDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + +cd "${BASEDIR}" +git -C "${DOTBOT_DIR}" submodule sync --quiet --recursive +git submodule update --init --recursive "${DOTBOT_DIR}" + +"${BASEDIR}/${DOTBOT_DIR}/${DOTBOT_BIN}" -d "${BASEDIR}" -c "${CONFIG}" "${@}" diff --git a/install.conf.yaml b/install.conf.yaml new file mode 100644 index 0000000..c6799d7 --- /dev/null +++ b/install.conf.yaml @@ -0,0 +1,18 @@ +- defaults: + link: + relink: true + +- clean: ['~'] + +- link: + ~/.config/nvim: nvim + ~/.zshrc: zsh/.zshrc + ~/.zprofile: zsh/.zprofile + ~/.gitconfig: .gitconfig + ~/.config/starship.toml: starship.toml + ~/.tmux.conf: tmux/.tmux.conf + +- shell: + - [git clone https://github.com/zsh-users/zsh-autosuggestions ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions, Installing zsh plugins] + - [git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm, Installing tmux and tmux-plugins] + diff --git a/install.sh b/install.sh deleted file mode 100755 index 3a4b2e1..0000000 --- a/install.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash - -BASEDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -echo "Base directory: ${BASEDIR}" - -# Add an argument for the flag -UNLINK_FLAG=$1 - -# Function for linking -link_configs() { - echo "Linking nvim to ~/.config/nvim/" - ln -s ${BASEDIR}/nvim ~/.config/nvim - - echo "Linking zsh dotfiles to ~/" - ln -s ${BASEDIR}/zsh/.zshrc ~/.zshrc - ln -s ${BASEDIR}/zsh/.zprofile ~/.zprofile - - echo "Installing zsh plugins" - git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions - - echo "Linking .gitconfig to ~/" - ln -s ${BASEDIR}/.gitconfig ~/.gitconfig - - echo "Linking starship.toml" - ln -s ${BASEDIR}/starship.toml ~/.config/starship.toml - - echo "Installing tmux and tmux-plugins" - git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm - ln -s ${BASEDIR}/tmux/.tmux.conf ~/.tmux.conf -} - -# Function for unlinking -unlink_configs() { - unlink ~/.config/nvim - unlink ~/.zshrc - unlink ~/.zprofile - unlink ~/.gitconfig - unlink ~/.config/starship.toml - rm -rf ~/.tmux/plugins/tpm - unlink ~/.tmux.conf - rm -rf ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions -} - -# Check the flag and call the appropriate function -if [ "$UNLINK_FLAG" == "--unlink" ]; then - echo "Unlinking symlinks..." - unlink_configs -else - echo "Creating symlinks..." - link_configs -fi diff --git a/zsh/.zshrc b/zsh/.zshrc index fc236a5..c8fed21 100644 --- a/zsh/.zshrc +++ b/zsh/.zshrc @@ -8,6 +8,7 @@ export PATH=$HOME/.local/bin:$PATH export PATH=$HOME/.cargo/bin:$PATH export PATH=$HOME/.fig/bin:$PATH export PATH=$HOME/.poetry/bin:$PATH +export PATH=/opt/homebrew/bin:$PATH export PATH=/opt/homebrew/opt/libpq/bin:$PATH export PATH=/opt/homebrew/opt/openjdk@17/bin:$PATH @@ -67,7 +68,7 @@ batdiff() { git diff --name-only --relative --diff-filter=d | xargs bat --diff } -gcl() { +git_cleanup() { git branch --merged | egrep -v "(^\*|master|main)" | xargs git branch -d }