diff --git a/.gitmodules b/.gitmodules index a3fb187..fde119c 100644 --- a/.gitmodules +++ b/.gitmodules @@ -8,16 +8,15 @@ url = https://github.com/wren/dotbot-brew.git ignore = dirty -[submodule "dotbot-if"] - path = dotbot-if - url = https://github.com/wonderbeyond/dotbot-if.git - ignore = dirty - [submodule "dotbot-gh-extension"] path = dotbot-gh-extension url = https://github.com/fundor333/dotbot-gh-extension.git ignore = dirty +[submodule "dotbot-include"] + path = dotbot-include + url = https://gitlab.com/gnfzdz/dotbot-include.git + [submodule "config/nvim"] path = config/nvim url = https://github.com/AstroNvim/AstroNvim.git diff --git a/add-submodules.sh b/add-submodules.sh index 570970c..82aa974 100644 --- a/add-submodules.sh +++ b/add-submodules.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +git submodule add --name dotbot-brew -f https://github.com/wren/dotbot-brew.git dotbot-brew git submodule add --name dotbot-gh-extension -f https://github.com/fundor333/dotbot-gh-extension.git dotbot-gh-extension -git submodule add --name dotbot-if -f https://github.com/wonderbeyond/dotbot-if.git dotbot-if +git submodule add --name dotbot-include -f https://gitlab.com/gnfzdz/dotbot-include.git dotbot-include diff --git a/dotbot-if b/dotbot-if deleted file mode 160000 index 2b4dc56..0000000 --- a/dotbot-if +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 2b4dc56943741d372881575cfc6e199103157220 diff --git a/dotbot-include b/dotbot-include new file mode 160000 index 0000000..6943c52 --- /dev/null +++ b/dotbot-include @@ -0,0 +1 @@ +Subproject commit 6943c521252b31799521ffc0f5d8b07685793a80 diff --git a/hosts/air/base/.gitkeep b/hosts/air/base/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/hosts/air/config/.gitkeep b/hosts/air/config/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/hosts/air/install.conf.yaml b/hosts/air/install.conf.yaml new file mode 100644 index 0000000..632da4e --- /dev/null +++ b/hosts/air/install.conf.yaml @@ -0,0 +1,15 @@ +- include: 'hosts/defaults.yaml' +- shell: + - echo "Configuring air" +- brewfile: + - Brewfile +- link: + ~/: + force: true + glob: true + path: hosts/air/base/** + prefix: "." + ~/.config/: + glob: true + force: true + path: hosts/air/config/** diff --git a/hosts/defaults.yaml b/hosts/defaults.yaml new file mode 100644 index 0000000..952c298 --- /dev/null +++ b/hosts/defaults.yaml @@ -0,0 +1,9 @@ +- defaults: + create: + mode: 0755 + link: + create: true + relink: true + exclude: ["*.md", "*renovate*"] + shell: + stdout: true diff --git a/hosts/lakka/base/.gitkeep b/hosts/lakka/base/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/hosts/lakka/config/.gitkeep b/hosts/lakka/config/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/hosts/lakka/install.conf.yaml b/hosts/lakka/install.conf.yaml new file mode 100644 index 0000000..71d54e0 --- /dev/null +++ b/hosts/lakka/install.conf.yaml @@ -0,0 +1,17 @@ +- include: 'hosts/defaults.yaml' +- shell: + - echo "Configuring lakka" +- link: + ~/: + force: true + glob: true + path: hosts/lakka/base/** + prefix: "." + ~/.config/: + glob: true + force: true + path: hosts/lakka/config/** + ~/.irssi/: + glob: true + force: true + path: hosts/lakka/irssi/** diff --git a/hosts/tunkki/base/.gitkeep b/hosts/tunkki/base/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/hosts/tunkki/config/.gitkeep b/hosts/tunkki/config/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/hosts/tunkki/install.conf.yaml b/hosts/tunkki/install.conf.yaml new file mode 100644 index 0000000..483d9b4 --- /dev/null +++ b/hosts/tunkki/install.conf.yaml @@ -0,0 +1,13 @@ +- include: 'hosts/defaults.yaml' +- shell: + - echo "Configuring tunkki" +- link: + ~/: + force: true + glob: true + path: hosts/tunkki/base/** + prefix: "." + ~/.config/: + glob: true + force: true + path: hosts/tunkki/config/** diff --git a/hosts/v/base/.gitkeep b/hosts/v/base/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/hosts/v/config/.gitkeep b/hosts/v/config/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/hosts/v/install.conf.yaml b/hosts/v/install.conf.yaml new file mode 100644 index 0000000..e2b48e1 --- /dev/null +++ b/hosts/v/install.conf.yaml @@ -0,0 +1,15 @@ +- include: 'hosts/defaults.yaml' +- shell: + - echo "Configuring v" +- brewfile: + - Brewfile +- link: + ~/: + force: true + glob: true + path: hosts/v/base/** + prefix: "." + ~/.config/: + glob: true + force: true + path: hosts/v/config/** diff --git a/install b/install index 849b6ef..cd2c8a6 100755 --- a/install +++ b/install @@ -8,6 +8,7 @@ DOTBOT_DIR="dotbot" DOTBOT_BIN="bin/dotbot" BASEDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" DOTBOT_BIN_PATH="${BASEDIR}/${DOTBOT_DIR}/${DOTBOT_BIN}" +DOTBOT_HOST="$(hostname -s)" || '' cd "$BASEDIR" git submodule sync --quiet --recursive @@ -17,6 +18,20 @@ git submodule update --init --recursive -d "${BASEDIR}" \ --plugin-dir=dotbot-brew \ --plugin-dir=dotbot-gh-extension \ - --plugin-dir=dotbot-if \ + --plugin-dir=dotbot-include \ -c "${CONFIG}" \ "${@}" + +if [ "${DOTBOT_HOST}" != "" ]; then + DOTBOT_HOST_CONFIG="${BASEDIR}/hosts/${DOTBOT_HOST}/${CONFIG}" + echo "-> Trying if host config can be found: ${DOTBOT_HOST_CONFIG}" + [ -r "$DOTBOT_HOST_CONFIG" ] && [ -f "$DOTBOT_HOST_CONFIG" ] \ + && echo "(!) Found $DOTBOT_HOST_CONFIG" \ + && "$DOTBOT_BIN_PATH" \ + -d "$BASEDIR" \ + --plugin-dir=dotbot-brew \ + --plugin-dir=dotbot-gh-extension \ + --plugin-dir=dotbot-include \ + -c "$DOTBOT_HOST_CONFIG" \ + "${@}" +fi diff --git a/install-without-plugins b/install-without-plugins index 3000d34..ea4e263 100755 --- a/install-without-plugins +++ b/install-without-plugins @@ -7,6 +7,7 @@ DOTBOT_DIR="dotbot" DOTBOT_BIN="bin/dotbot" BASEDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +DOTBOT_HOST="$(hostname -s)" || '' DOTBOT_BIN_PATH="${BASEDIR}/${DOTBOT_DIR}/${DOTBOT_BIN}" cd "$BASEDIR" @@ -15,6 +16,18 @@ git submodule update --init --recursive "${DOTBOT_BIN_PATH}" \ -d "${BASEDIR}" \ + --plugin-dir=dotbot-include \ -c "${CONFIG}" \ "${@}" +if [ "${DOTBOT_HOST}" != "" ]; then + DOTBOT_HOST_CONFIG="${BASEDIR}/hosts/${DOTBOT_HOST}/${CONFIG}" + echo "-> Trying if host config can be found: ${DOTBOT_HOST_CONFIG}" + [ -r "$DOTBOT_HOST_CONFIG" ] && [ -f "$DOTBOT_HOST_CONFIG" ] \ + && echo "(!) Found $DOTBOT_HOST_CONFIG" \ + && "$DOTBOT_BIN_PATH" \ + -d "$BASEDIR" \ + --plugin-dir=dotbot-include \ + -c "$DOTBOT_HOST_CONFIG" \ + "${@}" +fi diff --git a/install.conf.yaml b/install.conf.yaml index 5dcba50..20deb69 100644 --- a/install.conf.yaml +++ b/install.conf.yaml @@ -1,9 +1,4 @@ -- defaults: - create: - mode: 0755 - link: - create: true - exclude: ["*.md", "*renovate*"] +- include: 'hosts/defaults.yaml' - clean: ~/: ~/.config: @@ -19,6 +14,11 @@ mode: 0700 ~/Code: - link: + ~/: + force: true + glob: true + path: base/** + prefix: "." ~/.config/: glob: true path: config/** @@ -30,54 +30,9 @@ glob: true mode: 0600 path: ssh/** - ~/: - force: true - glob: true - path: base/** - prefix: "." - shell: - - [git submodule update --init --recursive --force] - - bash scripts/install-go-packages.sh -# hosts! -## hosts: air -- if: - - cond: "[[ $(hostname) = air ]]" - met: - - link: - ~/.config/: - glob: true - force: true - path: hosts/air/config/** -## hosts: v -- if: - - cond: "[[ $(hostname) = v ]]" - met: - - link: - ~/.config/: - glob: true - force: true - path: hosts/v/config/** -## hosts: tunkki -- if: - - cond: "[[ $(hostname) = tunkki ]]" - met: - - link: - ~/.config/: - glob: true - force: true - path: hosts/tunkki/config/** -## hosts: lakka -- if: - - cond: "[[ $(hostname) = lakka ]]" - met: - - link: - ~/.irssi/*: - force: true - glob: true - path: hosts/lakka/irssi/** - ~/.zshrc: - force: true - path: hosts/lakka/zshrc + - git submodule update --init --recursive --force + - bash local/bin/dfm install all # GitHub CLI Extensions - ghe: # GitHub CLI extension for generating a report on repository dependencies. diff --git a/local/bin/dfm b/local/bin/dfm index fee9708..1ace731 100755 --- a/local/bin/dfm +++ b/local/bin/dfm @@ -27,13 +27,19 @@ function section_install $0 install macos $0 install antigen $0 install starship + $0 brew install + $0 install composer $0 install nvm $0 install npm + $0 install ntfy ;; antigen) curl -L git.io/antigen > "$DOTFILES/local/bin/antigen.zsh" \ && msg_done "🎉 New antigen installed!" ;; + composer) + bash "$DOTFILES/scripts/install-composer.sh" \ + && msg_done "🎉 composer installed!" ;; starship) curl -sS https://starship.rs/install.sh | sh -s -- --bin-dir ~/.local/bin \ @@ -52,17 +58,20 @@ function section_install bash "$DOTFILES/scripts/install-npm-packages.sh" \ && msg_done "NPM Packages have been installed!" ;; - settler) - bash "$DOTFILES/scripts/settler.sh" && msg_done "🎉 Settler has been run!" + ntfy) + bash "$DOTFILES/scripts/install-ntfy.sh" \ + && msg_done "ntfy installed!" ;; *) - menu_section "$USAGE_PREFIX" "all | antigen | starship | nvm | npm | macos | settler" - menu_item "all" "Installs antigen, macos, brew and ext_gh" + menu_section "$USAGE_PREFIX" "all | antigen | composer | starship | macos | nvm | npm" + menu_item "all" "Installs macos defaults, antigen, starship, brew, nvm and npm packages" menu_item "antigen" "Updates the antigen.zsh file" + menu_item "composer" "Install composer" menu_item "starship" "Install starship.rs" menu_item "macos" "Setup nice macOS defaults" menu_item "nvm" "Install Node Version Manager (nvm)" menu_item "npm" "Install NPM Packages" + menu_item "ntfy" "Install ntfy" ;; esac } @@ -126,7 +135,7 @@ function section_dotfiles msg_ok "Linked nvim and astronvim" hash npm 2> /dev/null && $0 install npm msg_ok "Installed packages" - msg_done "...and we are done!" + msg_done "nvim reset!" ;; yamlfmt) # format yaml files diff --git a/scripts/set-macos-defaults.sh b/scripts/set-macos-defaults.sh index c6f55d6..2bf8084 100755 --- a/scripts/set-macos-defaults.sh +++ b/scripts/set-macos-defaults.sh @@ -19,6 +19,11 @@ while true; do kill -0 "$$" || exit done 2> /dev/null & +# Change user shell to zsh if not that already. +if hash zsh 2> /dev/null; then + [[ "$SHELL" != $(which zsh) ]] && chsh -s "$(which zsh)" +fi + ############################################################################### # General UI/UX # ###############################################################################