diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f101145..7889fed 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -22,13 +22,7 @@ jobs: token: ${{ secrets.PAT }} submodules: true - - name: Run setup + - name: Test setup run: | - ./install.sh - if [[ "$RUNNER_OS" == "Linux" ]]; then - ./set_up_debian.sh - ./set_up_debian_dev.sh --optional - elif [[ "$RUNNER_OS" == "macOS" ]]; then - ./macos/install.sh - ./macos/set_defaults.sh --optional - fi + ./scripts/install.sh + ./scripts/uninstall.sh diff --git a/.gitignore b/.gitignore index f140c86..66999a4 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -nvim/lua/machine_settings.lua +common/.config/nvim/lua/machine_settings.lua diff --git a/.aliases b/common/.aliases similarity index 100% rename from .aliases rename to common/.aliases diff --git a/nvim/init.lua b/common/.config/nvim/init.lua similarity index 100% rename from nvim/init.lua rename to common/.config/nvim/init.lua diff --git a/nvim/lazy-lock.json b/common/.config/nvim/lazy-lock.json similarity index 98% rename from nvim/lazy-lock.json rename to common/.config/nvim/lazy-lock.json index 0104043..013d5a1 100644 --- a/nvim/lazy-lock.json +++ b/common/.config/nvim/lazy-lock.json @@ -70,7 +70,7 @@ "plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" }, "promise-async": { "branch": "main", "commit": "119e8961014c9bfaf1487bf3c2a393d254f337e2" }, "quicker.nvim": { "branch": "master", "commit": "183041a46d6c908eefb1c23ea02cce9c8f41256e" }, - "render-markdown.nvim": { "branch": "main", "commit": "0986638b381a4b01eb108bb946f3a67a9eb3d0ec" }, + "render-markdown.nvim": { "branch": "main", "commit": "67288febca78b7aac8fae9543ef8980237e27d2a" }, "spaceless.nvim": { "branch": "main", "commit": "8d46bc098dba18d4e19bce89bf19aab5007ef767" }, "stickybuf.nvim": { "branch": "master", "commit": "183b9569bef78f44b17c078214f7d731f19cbefe" }, "substitute.nvim": { "branch": "main", "commit": "17ffaeb5a1dc2dbef39cf0865d8a4b6000836714" }, diff --git a/nvim/lua/common.lua b/common/.config/nvim/lua/common.lua similarity index 100% rename from nvim/lua/common.lua rename to common/.config/nvim/lua/common.lua diff --git a/nvim/lua/config_plugins/gitsigns.lua b/common/.config/nvim/lua/config_plugins/gitsigns.lua similarity index 100% rename from nvim/lua/config_plugins/gitsigns.lua rename to common/.config/nvim/lua/config_plugins/gitsigns.lua diff --git a/nvim/lua/config_plugins/lsp-zero.lua b/common/.config/nvim/lua/config_plugins/lsp-zero.lua similarity index 100% rename from nvim/lua/config_plugins/lsp-zero.lua rename to common/.config/nvim/lua/config_plugins/lsp-zero.lua diff --git a/nvim/lua/config_plugins/telescope.lua b/common/.config/nvim/lua/config_plugins/telescope.lua similarity index 100% rename from nvim/lua/config_plugins/telescope.lua rename to common/.config/nvim/lua/config_plugins/telescope.lua diff --git a/nvim/lua/config_plugins/treesitter.lua b/common/.config/nvim/lua/config_plugins/treesitter.lua similarity index 100% rename from nvim/lua/config_plugins/treesitter.lua rename to common/.config/nvim/lua/config_plugins/treesitter.lua diff --git a/nvim/lua/debugging.lua b/common/.config/nvim/lua/debugging.lua similarity index 100% rename from nvim/lua/debugging.lua rename to common/.config/nvim/lua/debugging.lua diff --git a/nvim/lua/ftplugin.lua b/common/.config/nvim/lua/ftplugin.lua similarity index 100% rename from nvim/lua/ftplugin.lua rename to common/.config/nvim/lua/ftplugin.lua diff --git a/nvim/lua/keymaps.lua b/common/.config/nvim/lua/keymaps.lua similarity index 100% rename from nvim/lua/keymaps.lua rename to common/.config/nvim/lua/keymaps.lua diff --git a/nvim/lua/overseer/template/user/populate_scripts.lua b/common/.config/nvim/lua/overseer/template/user/populate_scripts.lua similarity index 100% rename from nvim/lua/overseer/template/user/populate_scripts.lua rename to common/.config/nvim/lua/overseer/template/user/populate_scripts.lua diff --git a/nvim/lua/overseer/template/user/run_script.lua b/common/.config/nvim/lua/overseer/template/user/run_script.lua similarity index 100% rename from nvim/lua/overseer/template/user/run_script.lua rename to common/.config/nvim/lua/overseer/template/user/run_script.lua diff --git a/nvim/lua/overseer/template/user/run_script_with_args.lua b/common/.config/nvim/lua/overseer/template/user/run_script_with_args.lua similarity index 100% rename from nvim/lua/overseer/template/user/run_script_with_args.lua rename to common/.config/nvim/lua/overseer/template/user/run_script_with_args.lua diff --git a/nvim/lua/p.lua b/common/.config/nvim/lua/p.lua similarity index 100% rename from nvim/lua/p.lua rename to common/.config/nvim/lua/p.lua diff --git a/nvim/lua/plugins.lua b/common/.config/nvim/lua/plugins.lua similarity index 100% rename from nvim/lua/plugins.lua rename to common/.config/nvim/lua/plugins.lua diff --git a/nvim/lua/settings.lua b/common/.config/nvim/lua/settings.lua similarity index 100% rename from nvim/lua/settings.lua rename to common/.config/nvim/lua/settings.lua diff --git a/nvim/plugin/filetypes.lua b/common/.config/nvim/plugin/filetypes.lua similarity index 100% rename from nvim/plugin/filetypes.lua rename to common/.config/nvim/plugin/filetypes.lua diff --git a/nvim/snippets/global.code-snippets b/common/.config/nvim/snippets/global.code-snippets similarity index 100% rename from nvim/snippets/global.code-snippets rename to common/.config/nvim/snippets/global.code-snippets diff --git a/nvim/snippets/markdown.json b/common/.config/nvim/snippets/markdown.json similarity index 100% rename from nvim/snippets/markdown.json rename to common/.config/nvim/snippets/markdown.json diff --git a/nvim/snippets/package.json b/common/.config/nvim/snippets/package.json similarity index 100% rename from nvim/snippets/package.json rename to common/.config/nvim/snippets/package.json diff --git a/nvim/snippets/python.json b/common/.config/nvim/snippets/python.json similarity index 100% rename from nvim/snippets/python.json rename to common/.config/nvim/snippets/python.json diff --git a/nvim/snippets/shellscript.json b/common/.config/nvim/snippets/shellscript.json similarity index 100% rename from nvim/snippets/shellscript.json rename to common/.config/nvim/snippets/shellscript.json diff --git a/.p10k.zsh b/common/.p10k.zsh similarity index 100% rename from .p10k.zsh rename to common/.p10k.zsh diff --git a/.tmux.conf b/common/.tmux.conf similarity index 100% rename from .tmux.conf rename to common/.tmux.conf diff --git a/.wezterm.lua b/common/.wezterm.lua similarity index 95% rename from .wezterm.lua rename to common/.wezterm.lua index bb7850f..32b274a 100644 --- a/.wezterm.lua +++ b/common/.wezterm.lua @@ -32,11 +32,17 @@ config.font_size = 11 if wezterm.target_triple == 'aarch64-apple-darwin' then config.window_close_confirmation = 'NeverPrompt' config.window_decorations = "RESIZE" - config.font = wezterm.font{ + local weight = "Medium" + config.font_size = 12 + if wezterm.hostname() == "Jedrzejs-Mac-mini.local" then + config.font_size = 13 + weight = "Bold" + end + config.font = wezterm.font { family = 'Monaco Nerd Font', harfbuzz_features = { 'ss07', 'calt', 'liga=0' }, + weight = weight, } - config.font_size = 12 config.native_macos_fullscreen_mode = true else -- disable the window title bar diff --git a/debian/clangd b/debian/clangd new file mode 120000 index 0000000..8462b08 --- /dev/null +++ b/debian/clangd @@ -0,0 +1 @@ +../redundant/clangd \ No newline at end of file diff --git a/dotfiles_private b/dotfiles_private index 241c529..4286bb1 160000 --- a/dotfiles_private +++ b/dotfiles_private @@ -1 +1 @@ -Subproject commit 241c5296e5a27c99f1e906d969faf4a0e8f28585 +Subproject commit 4286bb156826d2c72a90c3d6d1129c44b30fa081 diff --git a/install.sh b/install.sh deleted file mode 100755 index 8bc5cfb..0000000 --- a/install.sh +++ /dev/null @@ -1,53 +0,0 @@ -#!/usr/bin/env bash - -set -x -set -e - -SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) - -copy=false -if [[ $1 == "--copy" ]]; then - copy=true -fi - -function add() { - rm -r "$2" || true - if [[ $copy == true ]]; then - cp -r "$1" "$2" - else - ln -s "$1" "$2" - fi -} - -# nvim -add "$SCRIPT_DIR/nvim" "$HOME/.config/nvim" - -# clangd -if [[ "$OSTYPE" == "linux-gnu"* ]]; then - add "$SCRIPT_DIR/clangd" "$HOME/.config/clangd" -elif [[ "$OSTYPE" == "darwin"* ]]; then - macos_clangd_path="$HOME/Library/Preferences/clangd" - mkdir -p "$macos_clangd_path" - add "$SCRIPT_DIR/clangd" "$macos_clangd_path" -else - echo "OS type unknown. Exiting." - exit 1 -fi - -# tmux -add "$SCRIPT_DIR/.tmux.conf" "$HOME/.tmux.conf" - -# .wezterm -add "$SCRIPT_DIR/.wezterm.lua" "$HOME/.wezterm.lua" - -# snippets -if [[ "$OSTYPE" == "linux-gnu"* ]]; then - vscode_snippets_path="$HOME/.config/Code/User/snippets" -elif [[ "$OSTYPE" == "darwin"* ]]; then - vscode_snippets_path="$HOME/Library/Application Support/Code/User/snippets" -else - echo "OS type unknown. Exiting." - exit 1 -fi -mkdir -p "$(dirname "${vscode_snippets_path}")" -add "$SCRIPT_DIR/nvim/snippets" "${vscode_snippets_path}" diff --git a/macos/.unison/default.prf b/macos/.unison/default.prf new file mode 100644 index 0000000..29b36b7 --- /dev/null +++ b/macos/.unison/default.prf @@ -0,0 +1,17 @@ +# roots define root directories for syncing between +root = /Users/jedrzej/Library/Mobile Documents/iCloud~md~obsidian/Documents/ +root = /Users/jedrzej/Dropbox/ObsidianVaults/ + +# dirs to sync +path=Personal + +# don't ask for confirmation +auto=true +batch=true +# sync ownership and group +owner=true +group=true +# for safety +confirmbigdel=true +# prefer newer in case of conflicts +prefer=newer diff --git a/macos/Library/Preferences/clangd b/macos/Library/Preferences/clangd new file mode 120000 index 0000000..c2e4d21 --- /dev/null +++ b/macos/Library/Preferences/clangd @@ -0,0 +1 @@ +../../../redundant/clangd \ No newline at end of file diff --git a/clangd/config.yaml b/redundant/clangd/config.yaml similarity index 100% rename from clangd/config.yaml rename to redundant/clangd/config.yaml diff --git a/set_up_debian_dev.sh b/scripts/debian/install.sh similarity index 100% rename from set_up_debian_dev.sh rename to scripts/debian/install.sh diff --git a/set_up_debian.sh b/scripts/debian/install_min.sh similarity index 99% rename from set_up_debian.sh rename to scripts/debian/install_min.sh index a9f963c..5173da8 100755 --- a/set_up_debian.sh +++ b/scripts/debian/install_min.sh @@ -1,6 +1,8 @@ #!/bin/bash set -e +SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) + function get_highest_tag_version() { git tag | sort -V | tail -n 1 } @@ -265,7 +267,7 @@ ln -s $(which fdfind) $HOME/.local/bin/fd || true sudo apt install ripgrep -y || true # run set_up_common.sh -./set_up_common.sh +"$SCRIPT_DIR/set_up_common.sh" if command -v doit &>/dev/null; then pipx install thefuck diff --git a/scripts/install.sh b/scripts/install.sh new file mode 100755 index 0000000..713f4fa --- /dev/null +++ b/scripts/install.sh @@ -0,0 +1,72 @@ +#!/usr/bin/env bash + +set -x +set -e + +SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) +ROOT_DIR=$(dirname "$SCRIPT_DIR") + +copy=false +if [[ $1 == "--copy" ]]; then + copy=true +fi + +function add() { + rm -r "$2" || true + if [[ $copy == true ]]; then + cp -r "$1" "$2" + else + ln -s "$1" "$2" + fi +} + +# snippets +if [[ "$OSTYPE" == "linux-gnu"* ]]; then + vscode_snippets_path="$HOME/.config/Code/User/snippets" +elif [[ "$OSTYPE" == "darwin"* ]]; then + vscode_snippets_path="$HOME/Library/Application Support/Code/User/snippets" +else + echo "OS type unknown. Exiting." + exit 1 +fi +mkdir -p "$(dirname "${vscode_snippets_path}")" +add "$SCRIPT_DIR/nvim/snippets" "${vscode_snippets_path}" + +cd "$ROOT_DIR" + +if ! [ -x "$(command -v stow)" ]; then + if [[ "$OSTYPE" == "linux-gnu"* ]]; then + sudo apt install stow -y + elif [[ "$OSTYPE" == "darwin"* ]]; then + if ! [ -x "$(command -v brew)" ]; then + /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" + fi + brew install stow + else + echo "Unsupported OS" + fi +fi + +# Stow common config +stow -t ~ common +cd dotfiles_private +stow -t ~ common_private +cd .. + +# Stow platform-specific config +if [[ "$OSTYPE" == "linux-gnu"* ]]; then + stow -t ~ debian + cd dotfiles_private + stow -t ~ debian_private + cd .. + scripts/debian/install_min.sh + scripts/debian/install.sh --optional +elif [[ "$OSTYPE" == "darwin"* ]]; then + stow -t ~ macos + cd dotfiles_private + stow -t ~ macos_private + cd .. + scripts/macos/install.sh +else + echo "Unsupported OS" +fi diff --git a/macos/install.sh b/scripts/macos/install.sh similarity index 81% rename from macos/install.sh rename to scripts/macos/install.sh index dd44936..fcf807c 100755 --- a/macos/install.sh +++ b/scripts/macos/install.sh @@ -2,9 +2,10 @@ set -e SCRIPT_DIR=$(dirname $0) -ROOT_DIR=$(dirname "$SCRIPT_DIR") +SCRIPTS_DIR=$(dirname "$SCRIPT_DIR") +ROOT_DIR=$(realpath "${SCRIPT_DIR}/../..") -$ROOT_DIR/set_up_common.sh +$SCRIPTS_DIR/set_up_common.sh KEYBOARD_SOURCE_PATH="$HOME/Library/Mobile Documents/com~apple~CloudDocs/Random/Keyboard Layouts/Polish-German.bundle" KEYBOARD_TARGET_PATH="$HOME/Library/Keyboard Layouts/Polish-German.bundle" @@ -20,7 +21,7 @@ if ! grep -Fxq "PasswordAuthentication no" "$SSH_CONFIG_PATH"; then echo "ChallengeResponseAuthentication no" | sudo tee -a "$SSH_CONFIG_PATH" fi -# karabiner config -rm "$HOME/.config/karabiner.edn" -ln -s "$ROOT_DIR/dotfiles_private/karabiner.edn" "$HOME/.config/karabiner.edn" +# run goku to install karabiner config goku || echo "goku not installed. Install with brew and run 'goku' when possible." + +$SCRIPT_DIR/set_defaults.sh diff --git a/macos/set_defaults.sh b/scripts/macos/set_defaults.sh similarity index 100% rename from macos/set_defaults.sh rename to scripts/macos/set_defaults.sh diff --git a/set_up_common.sh b/scripts/set_up_common.sh similarity index 100% rename from set_up_common.sh rename to scripts/set_up_common.sh diff --git a/scripts/uninstall.sh b/scripts/uninstall.sh new file mode 100755 index 0000000..262d266 --- /dev/null +++ b/scripts/uninstall.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash +set -e + +# Unstow platform-specific config +if [[ "$OSTYPE" == "linux-gnu"* ]]; then + cd dotfiles_private + stow -D -t ~ debian_private + cd .. + stow -D -t ~ debian +elif [[ "$OSTYPE" == "darwin"* ]]; then + cd dotfiles_private + stow -D -t ~ macos_private + cd .. + stow -D -t ~ macos +else + echo "Unsupported OS" +fi + +# Unstow common +cd dotfiles_private +stow -D -t ~ common_private +cd .. +stow -D -t ~ common diff --git a/uninstall.sh b/uninstall.sh deleted file mode 100755 index ac1255f..0000000 --- a/uninstall.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env bash -set -e - -rm -rf ~/.config/nvim -if [[ "$OSTYPE" == "linux-gnu"* ]]; then - rm -rf "$HOME/.config/clangd" -elif [[ "$OSTYPE" == "darwin"* ]]; then - rm -rf "$HOME/Library/Preferences/clangd/" -else - echo "OS type unknown. Exiting." - exit 1 -fi