Host specific files should now work

This commit is contained in:
2023-04-02 04:17:15 +03:00
parent 995cc569e7
commit d2cedd0fee
22 changed files with 132 additions and 66 deletions

9
.gitmodules vendored
View File

@@ -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

View File

@@ -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

Submodule dotbot-if deleted from 2b4dc56943

1
dotbot-include Submodule

Submodule dotbot-include added at 6943c52125

0
hosts/air/base/.gitkeep Normal file
View File

View File

View File

@@ -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/**

9
hosts/defaults.yaml Normal file
View File

@@ -0,0 +1,9 @@
- defaults:
create:
mode: 0755
link:
create: true
relink: true
exclude: ["*.md", "*renovate*"]
shell:
stdout: true

View File

View File

View File

@@ -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/**

View File

View File

View File

@@ -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/**

0
hosts/v/base/.gitkeep Normal file
View File

0
hosts/v/config/.gitkeep Normal file
View File

15
hosts/v/install.conf.yaml Normal file
View File

@@ -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/**

17
install
View File

@@ -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

View File

@@ -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

View File

@@ -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.

View File

@@ -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

View File

@@ -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 #
###############################################################################