Skip to content

Commit

Permalink
Install with stow
Browse files Browse the repository at this point in the history
  • Loading branch information
Jendker committed Sep 25, 2024
1 parent f97ca59 commit 9bbe5d0
Show file tree
Hide file tree
Showing 42 changed files with 137 additions and 85 deletions.
12 changes: 3 additions & 9 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
nvim/lua/machine_settings.lua
common/.config/nvim/lua/machine_settings.lua
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion nvim/lazy-lock.json → common/.config/nvim/lazy-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -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" },
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 8 additions & 2 deletions .wezterm.lua → common/.wezterm.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions debian/clangd
2 changes: 1 addition & 1 deletion dotfiles_private
53 changes: 0 additions & 53 deletions install.sh

This file was deleted.

17 changes: 17 additions & 0 deletions macos/.unison/default.prf
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions macos/Library/Preferences/clangd
File renamed without changes.
File renamed without changes.
4 changes: 3 additions & 1 deletion set_up_debian.sh → scripts/debian/install_min.sh
Original file line number Diff line number Diff line change
@@ -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
}
Expand Down Expand Up @@ -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
Expand Down
72 changes: 72 additions & 0 deletions scripts/install.sh
Original file line number Diff line number Diff line change
@@ -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
11 changes: 6 additions & 5 deletions macos/install.sh → scripts/macos/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
File renamed without changes.
File renamed without changes.
23 changes: 23 additions & 0 deletions scripts/uninstall.sh
Original file line number Diff line number Diff line change
@@ -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
12 changes: 0 additions & 12 deletions uninstall.sh

This file was deleted.

0 comments on commit 9bbe5d0

Please sign in to comment.