Skip to content

Commit

Permalink
rewrite with advanced configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
LucienMorey committed Oct 12, 2024
1 parent f7fb00d commit bd0fa25
Show file tree
Hide file tree
Showing 26 changed files with 206 additions and 139 deletions.
12 changes: 6 additions & 6 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
[submodule "dotbot"]
path = .dotbot
path = meta/.dotbot
url = [email protected]:kurtmckee/pr-dotbot.git
branch = resolve-dispatcher-plugins-failure-issue-339
[submodule "dotbot_plugins/dotbot-apt"]
path = .dotbot_plugins/dotbot-apt
path = meta/.dotbot_plugins/dotbot-apt
url = [email protected]:bryant1410/dotbot-apt
branch = master
[submodule "dotbot_plugins/dotbot-sudo"]
path = .dotbot_plugins/dotbot-sudo
path = meta/.dotbot_plugins/dotbot-sudo
url = [email protected]:DrDynamic/dotbot-sudo.git
branch = master
[submodule "dotbot_plugins/dotbot-snap"]
path = .dotbot_plugins/dotbot-snap
path = meta/.dotbot_plugins/dotbot-snap
url = [email protected]:DrDynamic/dotbot-snap.git
branch = master
[submodule "dotbot_plugins/dotbot-git"]
path = .dotbot_plugins/dotbot-git
path = meta/.dotbot_plugins/dotbot-git
url = [email protected]:DrDynamic/dotbot-git.git
branch = master
[submodule "dotbot_plugins/dotbot-if"]
path = .dotbot_plugins/dotbot-if
path = meta/.dotbot_plugins/dotbot-if
url = [email protected]:smergler/dotbot-if.git
branch = main
109 changes: 0 additions & 109 deletions .install.conf.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion .yamlfmt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
formatter:
type: basic
include_document_start: true
include_document_start: false
retain_line_breaks_single: true
eof_newline: true
23 changes: 0 additions & 23 deletions install

This file was deleted.

52 changes: 52 additions & 0 deletions install-profile
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/usr/bin/env bash

set -e

BASE_CONFIG="base"
CONFIG_SUFFIX=".yaml"

BASE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

META_DIR="${BASE_DIR}/meta"
CONFIG_DIR="${META_DIR}/configs"
PROFILES_DIR="${META_DIR}/profiles"

DOTBOT_DIR="${META_DIR}/.dotbot"
DOTBOT_BIN="bin/dotbot"
DOTBOT_PLUGIN_DIR="${META_DIR}/.dotbot_plugins"


cd "${BASE_DIR}"
git -C "${BASE_DIR}" submodule sync --quiet --recursive
git submodule update --init --recursive "${BASE_DIR}"


while IFS= read -r config; do
CONFIGS+=" ${config}"
done < "${PROFILES_DIR}/$1"

shift

for config in ${CONFIGS} ${@}; do
echo -e "\nConfigure $config"
# create temporary file
configFile="$(mktemp)"
suffix="-sudo"
echo -e "$(<"${META_DIR}/${BASE_CONFIG}${CONFIG_SUFFIX}")\n$(<"${CONFIG_DIR}/${config%"$suffix"}${CONFIG_SUFFIX}")" > "$configFile"

cmd=("${DOTBOT_DIR}/${DOTBOT_BIN}" -d "${BASE_DIR}" -c "$configFile" \
--plugin-dir "${DOTBOT_PLUGIN_DIR}/dotbot-apt" \
--plugin-dir "${DOTBOT_PLUGIN_DIR}/dotbot-git" \
--plugin-dir "${DOTBOT_PLUGIN_DIR}/dotbot-snap" \
--plugin-dir "${DOTBOT_PLUGIN_DIR}/dotbot-if" \
)

if [[ $config == *"sudo"* ]]; then
cmd=(sudo "${cmd[@]}")
fi

"${cmd[@]}"
rm -f "$configFile"
done

cd "${BASE_DIR}"
37 changes: 37 additions & 0 deletions install-standalone
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/usr/bin/env bash

set -e

BASE_CONFIG="base"
CONFIG_SUFFIX=".yaml"

META_DIR="meta"
CONFIG_DIR="configs"
PROFILES_DIR="profiles"

DOTBOT_DIR="dotbot"
DOTBOT_BIN="bin/dotbot"

BASE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"


cd "${BASE_DIR}"
git submodule update --init --recursive --remote

for config in ${@}; do
# create temporary file
configFile="$(mktemp)"
suffix="-sudo"
echo -e "$(<"${BASE_DIR}/${META_DIR}/${BASE_CONFIG}${CONFIG_SUFFIX}")\n$(<"${BASE_DIR}/${META_DIR}/${CONFIG_DIR}/${config%"$suffix"}${CONFIG_SUFFIX}")" > "$configFile"

cmd=("${BASE_DIR}/${META_DIR}/${DOTBOT_DIR}/${DOTBOT_BIN}" -d "${BASE_DIR}" -c "$configFile")

if [[ $config == *"sudo"* ]]; then
cmd=(sudo "${cmd[@]}")
fi

"${cmd[@]}"
rm -f "$configFile"
done

cd "${BASE_DIR}"
12 changes: 12 additions & 0 deletions meta/base.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

- defaults:
link:
create: true
relink: true
force: true
shell:
stdin: true
stdout: true
stderr: true

- clean: ['~', '~/.config']
13 changes: 13 additions & 0 deletions meta/configs/apt-install.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
- apt:
- curl
- zsh
- tmux
- build-essential
- xclip
- cmake
- gitk
- libfuse2
- pre-commit
- black
- clang
- clang-format
2 changes: 2 additions & 0 deletions meta/configs/bash-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- link:
~/.bashrc: bashrc
3 changes: 3 additions & 0 deletions meta/configs/change-shell-zsh.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# change to zsh for the user running the script
- shell:
- chsh -s $(which zsh) "$SUDO_USER"
5 changes: 5 additions & 0 deletions meta/configs/git-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# default git config
- shell:
- git config --global core.editor "nvim"
- git config --global user.name "Lucien Morey"
- git config --global init.defaultBranch main
4 changes: 4 additions & 0 deletions meta/configs/go-core-install.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- shell:
- wget https://go.dev/dl/go1.23.1.linux-amd64.tar.gz
- rm -rf /usr/local/go && tar -C /usr/local -xzf go1.23.1.linux-amd64.tar.gz
- rm -f go1.23.1.linux-amd64.tar.gz
3 changes: 3 additions & 0 deletions meta/configs/go-module-install.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# This has path set explicitly temporarily in case this is running as part of the first time execution and the path hasnt updated to include go
- shell:
- PATH=$PATH:/usr/local/go/bin go install github.com/google/yamlfmt/cmd/yamlfmt@latest
4 changes: 4 additions & 0 deletions meta/configs/nvim-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- link:
~/.config/nvim:
create: true
path: nvim
9 changes: 9 additions & 0 deletions meta/configs/nvim-install.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
- shell:
- wget https://github.com/neovim/neovim/releases/latest/download/nvim.appimage
- chmod u+x nvim.appimage

- create:
- /opt/nvim

- shell:
- mv nvim.appimage /opt/nvim/nvim
7 changes: 7 additions & 0 deletions meta/configs/snap-install.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
- snap:
- spotify:
- code:
classic: true
- slack:
- discord:
- bitwarden:
2 changes: 2 additions & 0 deletions meta/configs/tmux-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- link:
~/.tmux.conf: tmux.conf
9 changes: 9 additions & 0 deletions meta/configs/ui-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# update ubuntu dock with default preferred shortcuts
- shell:
- gsettings set org.gnome.shell favorite-apps "['firefox_firefox.desktop', 'thunderbird_thunderbird.desktop', 'org.gnome.Nautilus.desktop', 'code_code.desktop', 'org.gnome.Terminal.desktop', 'spotify_spotify.desktop', 'bitwarden_bitwarden.desktop']"
- dconf load /org/gnome/terminal/legacy/profiles:/ < gnome-terminal-profiles.dconf
- gsettings set org.gnome.desktop.background picture-uri "file://$(realpath ".")/wallpaper.jpg"
- gsettings set org.gnome.desktop.background picture-uri-dark "file://$(realpath ".")/wallpaper.jpg"
- gsettings set org.gnome.desktop.interface color-scheme "prefer-dark"
- gsettings set org.gnome.desktop.interface icon-theme "Yaru-viridian"
- gsettings set org.gnome.desktop.interface gtk-theme "Yaru-viridian-dark"
25 changes: 25 additions & 0 deletions meta/configs/zsh-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# install oh my zsh. this will not change the shell automatically (that is done later to save time on password injection)
- if:
cond: if [ -z $ZSH ] && [ ! -d /home/$USER/.oh-my-zsh ]; then exit 0; else exit 1;fi
met:
- shell:
- sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended
unmet:
- shell:
- echo ZSH already seems to be installed. skipping

# install auto suggestions for oh my zsh
- git:
'~/.oh-my-zsh/custom/plugins/zsh-autosuggestions':
url: 'https://github.com/zsh-users/zsh-autosuggestions'
description: 'oh my zsh - autosuggestions'
'~/.oh-my-zsh/custom/themes/powerlevel10k':
url: 'https://github.com/romkatv/powerlevel10k.git'
description: 'oh my zsh - powerlevel10k'
'~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting':
url: 'https://github.com/romkatv/zsh-syntax-highlighting.git'
description: 'oh my zsh - syntax highlighting'

- link:
~/.zshrc: zshrc
~/.p10k.zsh: p10k.zsh
12 changes: 12 additions & 0 deletions meta/profiles/workstation
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apt-install-sudo
snap-install-sudo
go-core-install-sudo
nvim-install-sudo
change-shell-zsh-sudo
zsh-config
bash-config
tmux-config
go-module-install
nvim-config
git-config
ui-config

0 comments on commit bd0fa25

Please sign in to comment.