Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
Jendker committed Sep 25, 2024
1 parent e4518e4 commit 3150e5d
Show file tree
Hide file tree
Showing 11 changed files with 158 additions and 105 deletions.
20 changes: 17 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# dotfiles

### TODO:
- at some point:
- use better option for installing dotfiles, like stow or [chezmoi](https://www.chezmoi.io)
To install:

Clone:
```
git clone https://github.com/Jendker/dotfiles.git ~/.dotfiles
# to clone with the private dotfiles
git clone --recurse-submodules https://github.com/Jendker/dotfiles.git ~/.dotfiles
```

Install:
```
# Minimal debian or macos
~/.dotfiles/scripts/install.sh
# Full debian install for development machine
~/.dotfiles/scripts/install.sh --dev
```
14 changes: 7 additions & 7 deletions common/.config/nvim/lazy-lock.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"CopilotChat.nvim": { "branch": "canary", "commit": "2352cd3e7e980cd73594be05f96b2dc4c0dd4a74" },
"CopilotChat.nvim": { "branch": "canary", "commit": "9333944fde3c65868818e245c73aa29eef826e9b" },
"LuaSnip": { "branch": "master", "commit": "e808bee352d1a6fcf902ca1a71cee76e60e24071" },
"Navigator.nvim": { "branch": "master", "commit": "91d86506ac2a039504d5205d32a1d4bc7aa57072" },
"aerial.nvim": { "branch": "master", "commit": "140f48fb068d21c02e753c63f7443649e55576f0" },
Expand All @@ -16,7 +16,7 @@
"copilot.lua": { "branch": "master", "commit": "1a237cf50372830a61d92b0adf00d3b23882e0e1" },
"diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" },
"dressing.nvim": { "branch": "master", "commit": "1b7921eecc65af1baf8ac1dc06f0794934cbcfb2" },
"dropbar.nvim": { "branch": "master", "commit": "b7b0cd2670cfab298afc955f2531206218736766" },
"dropbar.nvim": { "branch": "master", "commit": "a12869f34f8cd236dc708fb2815ccf1663000bf4" },
"flash.nvim": { "branch": "main", "commit": "34c7be146a91fec3555c33fe89c7d643f6ef5cf1" },
"friendly-snippets": { "branch": "main", "commit": "00ba9dd3df89509f95437b8d595553707c46d5ea" },
"fugitive-gitlab.vim": { "branch": "master", "commit": "838d3a110836f511be099002ce1a71493c042615" },
Expand All @@ -30,7 +30,7 @@
"indent-blankline.nvim": { "branch": "master", "commit": "18603eb949eba08300799f64027af11ef922283f" },
"kanagawa.nvim": { "branch": "master", "commit": "f491b0fe68fffbece7030181073dfe51f45cda81" },
"last-color.nvim": { "branch": "main", "commit": "4086c5810bbe35b4184502f190e8d1ba910180cd" },
"lazy.nvim": { "branch": "main", "commit": "460e1cd8f24e364d54543a4b0e83f6f4ec1f65fb" },
"lazy.nvim": { "branch": "main", "commit": "077102c5bfc578693f12377846d427f49bc50076" },
"lsp-zero.nvim": { "branch": "v4.x", "commit": "b8411704591ae8e1501f1b9b31c801c09927baac" },
"lsp_signature.nvim": { "branch": "master", "commit": "fc38521ea4d9ec8dbd4c2819ba8126cea743943b" },
"lualine.nvim": { "branch": "master", "commit": "b431d228b7bbcdaea818bdc3e25b8cdbe861f056" },
Expand All @@ -39,7 +39,7 @@
"mason-null-ls.nvim": { "branch": "main", "commit": "de19726de7260c68d94691afb057fa73d3cc53e7" },
"mason-nvim-dap.nvim": { "branch": "main", "commit": "8b9363d83b5d779813cdd2819b8308651cec2a09" },
"mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" },
"neoconf.nvim": { "branch": "main", "commit": "c5516054f2342e6fe4d3befd56249d02d5eeb380" },
"neoconf.nvim": { "branch": "main", "commit": "4bba87a057867004e70596dafe7262bbaac38810" },
"neoscroll.nvim": { "branch": "master", "commit": "4e0428a41c6ec191df543fc95349f6e1c598e53f" },
"nvim-autopairs": { "branch": "master", "commit": "f158dcb865c36f72c92358f87787dab2c272eaf3" },
"nvim-bqf": { "branch": "main", "commit": "1b24dc6050c34e8cd377b6b4cd6abe40509e0187" },
Expand All @@ -53,12 +53,12 @@
"nvim-early-retirement": { "branch": "main", "commit": "2c36a5671b9d8f0d9e11b77c5a55de802bc45e34" },
"nvim-fundo": { "branch": "main", "commit": "ac9c9372c4bf677721e24f144ef29d3a05c2b589" },
"nvim-lint": { "branch": "master", "commit": "968a35d54b3a4c1ce66609cf80b14d4ae44fe77f" },
"nvim-lspconfig": { "branch": "master", "commit": "dd329912c8d446240584a2dbcd3802af3a19105a" },
"nvim-lspconfig": { "branch": "master", "commit": "a9bc587e9ae0cbcb3e90a2e9342f86b3b78c4408" },
"nvim-nio": { "branch": "master", "commit": "a428f309119086dc78dd4b19306d2d67be884eee" },
"nvim-scrollview": { "branch": "main", "commit": "401c0498689dcaa54b2e7483d823e33cdc051e72" },
"nvim-spectre": { "branch": "master", "commit": "ba7fb777edff6c1fbbeffd343e113af64c04e90a" },
"nvim-surround": { "branch": "main", "commit": "ec2dc7671067e0086cdf29c2f5df2dd909d5f71f" },
"nvim-treesitter": { "branch": "master", "commit": "6511cd984ab4b21e28f83af488f38dc89c3b0586" },
"nvim-treesitter": { "branch": "master", "commit": "0c8a582e474e248f2a4406188e0c653f92a064cf" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "bf8d2ad35d1d1a687eae6c065c3d524f7ab61b23" },
"nvim-web-devicons": { "branch": "master", "commit": "26220156aafb198b2de6a4cf80c1b120a3768da0" },
"oil.nvim": { "branch": "master", "commit": "1360be5fda9c67338331abfcd80de2afbb395bcd" },
Expand All @@ -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": "67288febca78b7aac8fae9543ef8980237e27d2a" },
"render-markdown.nvim": { "branch": "main", "commit": "aad1a1220dc9da5757e3af3befbc7fc3869dd334" },
"spaceless.nvim": { "branch": "main", "commit": "8d46bc098dba18d4e19bce89bf19aab5007ef767" },
"stickybuf.nvim": { "branch": "master", "commit": "183b9569bef78f44b17c078214f7d731f19cbefe" },
"substitute.nvim": { "branch": "main", "commit": "17ffaeb5a1dc2dbef39cf0865d8a4b6000836714" },
Expand Down
1 change: 1 addition & 0 deletions debian/.config/clangd
1 change: 0 additions & 1 deletion debian/clangd

This file was deleted.

2 changes: 1 addition & 1 deletion dotfiles_private
5 changes: 2 additions & 3 deletions scripts/debian/install.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/bash
set -e
set -x

SCRIPT_DIR=$(dirname "$0")
ROOT_DIR=$(realpath "${SCRIPT_DIR}/../..")
Expand All @@ -20,8 +21,6 @@ function setup_nerdfont() {
git clone https://github.com/epk/SF-Mono-Nerd-Font.git /tmp/SF-Mono-Nerd-Font
cp /tmp/SF-Mono-Nerd-Font/*.otf ~/.local/share/fonts/
rm -rf /tmp/SF-Mono-Nerd-Font
cp "$ROOT_DIR"/dotfiles_private/fonts/* ~/.local/share/fonts/
rm ~/.local/share/fonts/MonacoNerdFont-Regular.ttf
fc-cache -f
}

Expand All @@ -43,7 +42,7 @@ function setup_spotify() {
if ! [ -x "$(command -v spotify)" ]; then
curl -sS https://download.spotify.com/debian/pubkey_6224F9941A8AA6D1.gpg | sudo gpg --dearmor --yes -o /etc/apt/trusted.gpg.d/spotify.gpg
echo "deb http://repository.spotify.com stable non-free" | sudo tee /etc/apt/sources.list.d/spotify.list
sudo apt-get update && sudo apt-get install spotify-client
sudo apt-get update && sudo apt-get install spotify-client -y
fi
}

Expand Down
97 changes: 43 additions & 54 deletions scripts/debian/install_min.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/bash
set -e
set -x

SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)

Expand Down Expand Up @@ -28,8 +29,6 @@ function install_nvim_source() {
branch_str="--branch $1"
fi
sudo apt-get install ninja-build gettext cmake unzip curl -y
sudo apt install libreadline-dev -y # for hererocks
sudo apt install libmagickwand-dev -y # for image.nvim
cd /tmp && rm -rf neovim && git clone https://github.com/neovim/neovim.git $branch_str --single-branch
cd neovim
if [ "$1" == "master" ]; then
Expand Down Expand Up @@ -58,17 +57,6 @@ function install_nvim_tarball() {
export PATH="$PATH:/opt/nvim-linux64/bin"
}

function update_dotfiles() {
cd /tmp/ && rm -rf dotfiles && git clone https://github.com/Jendker/dotfiles.git
mkdir -p $HOME/.config
bash dotfiles/install.sh --copy
run_times=1
nvim --headless "+Lazy! install" +qa
# repeat again until successful
while [ $? -ne 0 ]; do !!; done
rm -rf dotfiles
}

function install_node() {
installed=false
if ! [ -x "$(command -v nvm)" ]; then
Expand Down Expand Up @@ -160,6 +148,8 @@ function install_nvim_binary() {
fi
install_node
update_git
sudo apt install libreadline-dev -y # for hererocks
sudo apt install libmagickwand-dev -y # for image.nvim
}

function install_zoxide() {
Expand Down Expand Up @@ -218,16 +208,12 @@ function install_direnv() {
}

if [[ ! $# -eq 0 ]]; then
if [[ $1 == "--update" ]]; then
echo "Updating dotfiles..."
update_dotfiles
exit 0
elif [[ $1 == "--update-nvim" ]]; then
echo "Updating nvim binary..."
if [[ $1 == "--install-nvim" ]]; then
echo "Installing nvim binary..."
install_nvim_binary stable
exit 0
elif [[ $1 == "--update-nvim-dev" ]]; then
echo "Updating nvim binary from git dev branch..."
elif [[ $1 == "--install-nvim-dev" ]]; then
echo "Installing nvim binary from git dev branch..."
install_nvim_binary master
exit 0
elif [[ $1 == "--install-node" ]]; then
Expand Down Expand Up @@ -256,8 +242,9 @@ if [[ ! $# -eq 0 ]]; then
fi
fi

# --- MAIN ---
sudo apt update
sudo apt install tmux curl wget locales lsb-release zsh xclip unzip python3-venv fd-find ccache git imagemagick pipx -y
sudo apt install tmux curl wget locales lsb-release zsh xclip unzip python3-venv fd-find ccache git imagemagick pipx libglib2.0-bin vim zsh -y
# for thefuck
sudo apt install python3-dev python3-pip python3-setuptools -y
# symlink fdfind as fd
Expand All @@ -266,12 +253,38 @@ ln -s $(which fdfind) $HOME/.local/bin/fd || true

sudo apt install ripgrep -y || true

# set up nvim
if ! [ -x "$(command -v nvim)" ]; then
echo 'nvim is not installed. installing'
install_nvim_binary stable
# install plugins
nvim --headless "+Lazy! install" +qa
# repeat again until successful
while [ $? -ne 0 ]; do !!; done
fi

# set up fzf for zsh
if [ ! -d "$HOME/.fzf" ]; then
git clone --depth 1 https://github.com/junegunn/fzf.git $HOME/.fzf
$HOME/.fzf/install --key-bindings --completion --update-rc --no-bash
fi

# install git lfs
if ! command_exists git-lfs; then
curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash && sudo apt-get install git-lfs && git lfs install
fi

install_zoxide

install_direnv

install_delta

install_gh

# run set_up_common.sh
"$SCRIPT_DIR/../set_up_common.sh"

if command -v doit &>/dev/null; then
pipx install thefuck
fi
if ! grep -q "unsetopt BEEP" $HOME/.zshrc; then
sudo tee -a $HOME/.zshrc >/dev/null <<'EOT'
if command -v nvim &> /dev/null; then
Expand All @@ -286,10 +299,12 @@ export LC_ALL=en_US.UTF-8
export PATH=$PATH:$HOME/.local/bin
export PATH="/usr/lib/ccache:$PATH"
eval $(thefuck --alias doit)
# don't show the warning which happens if direnv loads the .envrc file
typeset -g POWERLEVEL9K_INSTANT_PROMPT=quiet
EOT

if command -v thefuck &>/dev/null; then
pipx install thefuck
fi

# set plugin variables before sourcing oh-my-zsh
ex -s $HOME/.zshrc <<\IN
/source \$ZSH\/oh-my-zsh.sh/i
Expand All @@ -314,29 +329,3 @@ sudo locale-gen en_US.UTF-8

# .tmux.conf
grep -qxF 'set-option -g default-shell /bin/zsh' $HOME/.tmux.conf || echo "set-option -g history-limit 125000\nset-option -g default-shell /bin/zsh" >>$HOME/.tmux.conf

# set up nvim
if ! [ -x "$(command -v nvim)" ]; then
echo 'nvim is not installed. installing'
install_nvim_binary stable
update_dotfiles
fi

# set up fzf for zsh
if [ ! -d "$HOME/.fzf" ]; then
git clone --depth 1 https://github.com/junegunn/fzf.git $HOME/.fzf
$HOME/.fzf/install --key-bindings --completion --update-rc --no-bash
fi

# install git lfs
if ! command_exists git-lfs; then
curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash && sudo apt-get install git-lfs && git lfs install
fi

install_zoxide

install_direnv

install_delta

install_gh
73 changes: 54 additions & 19 deletions scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,22 @@ set -e
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
ROOT_DIR=$(dirname "$SCRIPT_DIR")

# Initialize flags
dev=false
copy=false
install_only=false

# Loop through the arguments
for arg in "$@"; do
if [ "$arg" == "--copy" ]; then
copy=true
elif [ "$arg" == "--optional" ]; then
dev=true
elif [ "$arg" == "--install-only" ]; then
install_only=true
fi
done

copy=false
if [[ $1 == "--copy" ]]; then
copy=true
Expand Down Expand Up @@ -43,30 +59,49 @@ if ! [ -x "$(command -v stow)" ]; then
fi
brew install stow
else
echo "Unsupported OS"
echo "Unsupported OS"
fi
fi

# Stow common config
stow -t ~ common
cd dotfiles_private/stow
stow -t ~ common_private
cd ../..

# Stow platform-specific config
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
stow -t ~ debian
cd dotfiles_private/stow
stow -t ~ debian_private
cd ../..
scripts/debian/install_min.sh
scripts/debian/install.sh --optional
prefix="debian"
elif [[ "$OSTYPE" == "darwin"* ]]; then
stow -t ~ macos
cd dotfiles_private/stow
stow -t ~ macos_private
cd ../..
scripts/macos/install.sh
prefix="macos"
else
echo "Unsupported OS"
echo "Unsupported OS"
fi

if [[ $install_only != true ]]; then
# Stow common config
stow -t ~ common
stow -t ~ "${prefix}"
fi

# Platform-specific config install
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
"${SCRIPT_DIR}/debian/install_min.sh"
if [[ $dev == true ]]; then
"${SCRIPT_DIR}/debian/install.sh" --optional
fi
elif [[ "$OSTYPE" == "darwin"* ]]; then
"${SCRIPT_DIR}/macos/install.sh"
else
echo "Unsupported OS"
fi

echo "Current directory: $(pwd)"

# Private submodule install
SUBMODULE_PATH="dotfiles_private"
# Check if the submodule is not empty
if [[ ! -z "$(ls -A ${SUBMODULE_PATH})" ]]; then
echo "Private submodule is available. Installing..."
install_only_arg=""
if [[ $install_only == true ]]; then
install_only_arg="--install-only"
fi
"${SUBMODULE_PATH}/scripts/install.sh" $install_only_arg
else
echo "Private submodule is not cloned. Skipping installation."
fi
1 change: 0 additions & 1 deletion scripts/macos/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ if [ -e "$KEYBOARD_SOURCE_PATH" ] && [ ! -e $KEYBOARD_TARGET_PATH ]; then
cp "$KEYBOARD_SOURCE_PATH" "$KEYBOARD_TARGET_PATH"
echo "Reboot and add the Polish-German keyboard layout from Polish keyboards"
fi
cp $ROOT_DIR/dotfiles_private/fonts/* ~/Library/Fonts/

SSH_CONFIG_PATH=/etc/ssh/sshd_config.d/100-macos.conf
if ! grep -Fxq "PasswordAuthentication no" "$SSH_CONFIG_PATH"; then
Expand Down
Loading

0 comments on commit 3150e5d

Please sign in to comment.