Skip to content

Commit a92d60c

Browse files
authored
Add setup of MacOS M1 (#13)
1 parent 4838460 commit a92d60c

File tree

18 files changed

+458
-53
lines changed

18 files changed

+458
-53
lines changed

dotfiles

env-available/macos-m1-12/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*.zip
2+
neovim/

env-available/macos-m1-12/bashrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2+
source /Users/buda/.docker/init-bash.sh || true # Added by Docker Desktop
3+
. "$HOME/.cargo/env"
4+
5+
. "$HOME/Scripts/public/dotfiles/bash_aliases"

env-available/macos-m1-12/setup.sh

Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
#!/bin/bash -e
2+
3+
# TODO: xelatex https://gist.github.com/peterhurford/75957ba9335e755013b87254ec85fab1
4+
#
5+
# TODO: python3 -m pip install --user ansible
6+
# TODO: PATH=$PATH:/Users/buda/Library/Python10/bin
7+
#
8+
# TODO: https://github.com/ohmyzsh/ohmyzsh ~/.oh-my-zsh dir
9+
# https://github.com/zsh-users/zsh-autosuggestions/blob/master/INSTALL.md
10+
# TODO: Install fish -> https://gist.github.com/idleberg/9c7aaa3abedc58694df5
11+
# fish_config command + the whole ~/.config/fish/ folder
12+
#
13+
# TODO:
14+
# brew install mkdocs
15+
#
16+
# TODO:
17+
# brew install sphinx-doc
18+
# brew link sphinx-doc --force # https://stackoverflow.com/questions/36137496/os-x-install-of-sphinx-the-sphinx-build-and-sphinx-quickstart-not-found
19+
# pip3 install m2r
20+
#
21+
# TODO: antlr4
22+
# curl -L -O http://www.antlr.org/download/antlr-4.13.1-complete.jar
23+
24+
RM_DEPS=(
25+
# rm_neovim
26+
# rm_nvchad
27+
)
28+
29+
DEPS=(
30+
wget git htop tmux
31+
fish
32+
shellcheck
33+
custom-xcode
34+
clang-format
35+
ffmpeg
36+
pdftk-java
37+
gnuplot
38+
pandoc basictex
39+
# Valgrind doesn't work on Apple Silicon yet (2023-01-28).
40+
# valgrind
41+
qcachegrind
42+
# There is some issue here the .prof file is generated but almost empty.
43+
# pprof loads 0 nodes.
44+
gperftools
45+
virtualenv
46+
minio/stable/minio
47+
node
48+
custom-rust
49+
custom-nvim
50+
custom-nvchad
51+
custom-fonts
52+
cargo-flamegraph
53+
)
54+
55+
script_dir="$( cd "$(dirname "$([ -L "$0" ] && readlink -f "$0" || echo "$0")")" && pwd)"
56+
# shellcheck disable=SC1090
57+
source "$script_dir/../../util/os_util"
58+
59+
function rm_neovim {
60+
echo "Removing neovim"
61+
rm -rf $script_dir/neovim
62+
}
63+
function rm_nvchad {
64+
echo "Removing nvchad"
65+
rm -rf $1/.config/nvim/lazy-lock.json
66+
rm -rf $1/.config/nvim
67+
rm -rf $1/.local/share/nvim
68+
rm -rf $1/.cache/nvim
69+
}
70+
71+
function install_font {
72+
download_link=$1
73+
local_file_name=$2
74+
if [ ! -f "$local_file_name" ]; then
75+
wget "$download_link" -O "$local_file_name"
76+
mkdir -p "/Users/$USER/Library/Fonts"
77+
unzip "$local_file_name" -d "/Users/$USER/Library/Fonts"
78+
fi
79+
}
80+
81+
PUBLIC_DOTFILES="gitconfig gitignore"
82+
for f in ${PUBLIC_DOTFILES}; do
83+
rm -rf "/Users/$USER/.$f"
84+
ln -s "${script_dir}/../../dotfiles/$f" "/Users/$USER/.$f"
85+
done
86+
87+
LOCAL_DOTFILES="zshrc zshenv tmux.conf bashrc"
88+
for f in ${LOCAL_DOTFILES}; do
89+
rm -rf "/Users/$USER/.$f"
90+
ln -s "${script_dir}/$f" "/Users/$USER/.$f"
91+
done
92+
93+
for rm_pkg in "${RM_DEPS[@]}"; do
94+
"$rm_pkg" "$HOME"
95+
done
96+
97+
for pkg in "${DEPS[@]}"; do
98+
# if [ "$pkg" == ]; then
99+
# fi
100+
101+
if [ "$pkg" == custom-xcode ]; then
102+
continue # TODO: Check xcode-select -p https://stackoverflow.com/questions/21272479/how-can-i-find-out-if-i-have-xcode-commandline-tools-installed
103+
xcode-select --install
104+
echo "xcode installed." && continue
105+
fi
106+
107+
if [ "$pkg" == custom-nvim ]; then
108+
if ! bin_installed "$script_dir/neovim/build/bin/nvim"; then
109+
cd "$script_dir"
110+
git clone https://github.com/neovim/neovim
111+
cd neovim
112+
git checkout v0.10.4
113+
make CMAKE_BUILD_TYPE=Release -j4
114+
sudo make install
115+
fi
116+
echo "$pkg is installed." && continue
117+
fi
118+
if [ "$pkg" == custom-nvchad ]; then
119+
NVIM_CONF_DIR="/Users/$USER/.config/nvim"
120+
if [ ! -L "$NVIM_CONF_DIR" ]; then
121+
ln -s "$script_dir/../../nvchad-v2.5" "$NVIM_CONF_DIR"
122+
fi
123+
echo "$pkg is installed." && continue
124+
fi
125+
126+
if [ "$pkg" == custom-fonts ]; then
127+
cd "$script_dir"
128+
install_font "https://dl.dafont.com/dl/?f=roboto" "Roboto.zip"
129+
echo "$pkg is installed." && continue
130+
fi
131+
132+
if [ "$pkg" == custom-rust ]; then
133+
if ! bin_installed "$HOME/.cargo/bin/cargo"; then
134+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
135+
fi
136+
rustup update stable
137+
rustup default stable
138+
echo "$pkg is installed." && continue
139+
fi
140+
141+
if [ "$pkg" == cargo-flamegraph ]; then
142+
cargo install flamegraph
143+
echo "$pkg is installed." && continue
144+
fi
145+
146+
if ! brew_installed "$pkg"; then
147+
brew install "$pkg"
148+
fi
149+
echo "$pkg is installed." && continue
150+
done

env-available/macos-m1-12/tmux.conf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
setw -g mouse on
2+
set-option -sg escape-time 10
3+
set-option -g focus-events on
4+
set -g status-fg black
5+
set -g status-bg colour7
6+
set -g status-left-length 50
7+
set -g history-limit 100000

env-available/macos-m1-12/zshenv

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
. "$HOME/.cargo/env"
2+
. "$HOME/Scripts/public/dotfiles/bash_aliases"

env-available/macos-m1-12/zshrc

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
# If you come from bash you might have to change your $PATH.
2+
# export PATH=$HOME/bin:/usr/local/bin:$PATH
3+
4+
# Path to your oh-my-zsh installation.
5+
export ZSH="$HOME/.oh-my-zsh"
6+
7+
# Set name of the theme to load --- if set to "random", it will
8+
# load a random theme each time oh-my-zsh is loaded, in which case,
9+
# to know which specific one was loaded, run: echo $RANDOM_THEME
10+
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
11+
ZSH_THEME="robbyrussell"
12+
13+
# Set list of themes to pick from when loading at random
14+
# Setting this variable when ZSH_THEME=random will cause zsh to load
15+
# a theme from this variable instead of looking in $ZSH/themes/
16+
# If set to an empty array, this variable will have no effect.
17+
# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" )
18+
19+
# Uncomment the following line to use case-sensitive completion.
20+
# CASE_SENSITIVE="true"
21+
22+
# Uncomment the following line to use hyphen-insensitive completion.
23+
# Case-sensitive completion must be off. _ and - will be interchangeable.
24+
# HYPHEN_INSENSITIVE="true"
25+
26+
# Uncomment one of the following lines to change the auto-update behavior
27+
# zstyle ':omz:update' mode disabled # disable automatic updates
28+
# zstyle ':omz:update' mode auto # update automatically without asking
29+
# zstyle ':omz:update' mode reminder # just remind me to update when it's time
30+
31+
# Uncomment the following line to change how often to auto-update (in days).
32+
# zstyle ':omz:update' frequency 13
33+
34+
# Uncomment the following line if pasting URLs and other text is messed up.
35+
# DISABLE_MAGIC_FUNCTIONS="true"
36+
37+
# Uncomment the following line to disable colors in ls.
38+
# DISABLE_LS_COLORS="true"
39+
40+
# Uncomment the following line to disable auto-setting terminal title.
41+
# DISABLE_AUTO_TITLE="true"
42+
43+
# Uncomment the following line to enable command auto-correction.
44+
# ENABLE_CORRECTION="true"
45+
46+
# Uncomment the following line to display red dots whilst waiting for completion.
47+
# You can also set it to another string to have that shown instead of the default red dots.
48+
# e.g. COMPLETION_WAITING_DOTS="%F{yellow}waiting...%f"
49+
# Caution: this setting can cause issues with multiline prompts in zsh < 5.7.1 (see #5765)
50+
# COMPLETION_WAITING_DOTS="true"
51+
52+
# Uncomment the following line if you want to disable marking untracked files
53+
# under VCS as dirty. This makes repository status check for large repositories
54+
# much, much faster.
55+
# DISABLE_UNTRACKED_FILES_DIRTY="true"
56+
57+
# Uncomment the following line if you want to change the command execution time
58+
# stamp shown in the history command output.
59+
# You can set one of the optional three formats:
60+
# "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
61+
# or set a custom format using the strftime function format specifications,
62+
# see 'man strftime' for details.
63+
# HIST_STAMPS="mm/dd/yyyy"
64+
65+
# Would you like to use another custom folder than $ZSH/custom?
66+
# ZSH_CUSTOM=/path/to/new-custom-folder
67+
68+
# Which plugins would you like to load?
69+
# Standard plugins can be found in $ZSH/plugins/
70+
# Custom plugins may be added to $ZSH_CUSTOM/plugins/
71+
# Example format: plugins=(rails git textmate ruby lighthouse)
72+
# Add wisely, as too many plugins slow down shell startup.
73+
plugins=(git tmux brew zsh-autosuggestions zsh-syntax-highlighting)
74+
75+
source $ZSH/oh-my-zsh.sh
76+
77+
# User configuration
78+
export CLASSPATH="/usr/local/lib/antlr-4.13.1-complete.jar"
79+
80+
# export MANPATH="/usr/local/man:$MANPATH"
81+
82+
# You may need to manually set your language environment
83+
# export LANG=en_US.UTF-8
84+
85+
# Preferred editor for local and remote sessions
86+
# if [[ -n $SSH_CONNECTION ]]; then
87+
# export EDITOR='vim'
88+
# else
89+
# export EDITOR='mvim'
90+
# fi
91+
92+
# Compilation flags
93+
# export ARCHFLAGS="-arch x86_64"
94+
95+
# Set personal aliases, overriding those provided by oh-my-zsh libs,
96+
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
97+
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
98+
# For a full list of active aliases, run `alias`.
99+
#
100+
# Example aliases
101+
# alias zshconfig="mate ~/.zshrc"
102+
# alias ohmyzsh="mate ~/.oh-my-zsh"
103+
104+
# Generated for envman. Do not edit.
105+
[ -s "$HOME/.config/envman/load.sh" ] && source "$HOME/.config/envman/load.sh"
106+
107+
source "$HOME/.cargo/env"
108+
109+
source /Users/buda/.docker/init-zsh.sh || true # Added by Docker Desktop
110+
111+
. "$HOME/.zshenv"
112+
113+
# pnpm
114+
export PNPM_HOME="/Users/buda/Library/pnpm"
115+
case ":$PATH:" in
116+
*":$PNPM_HOME:"*) ;;
117+
*) export PATH="$PNPM_HOME:$PATH" ;;
118+
esac
119+
# pnpm end

env-enabled/macos-m1-12.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../env-available/macos-m1-12/setup.sh

nvchad-v2.0/configs/lspconfig.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ for _, lsp in ipairs(servers) do
1717
"clangd",
1818
-- "--clang-tidy",
1919
}
20-
opts.capabilities.offsetEncoding = "utf-8"
20+
-- TODO(gitbuda): This works for C++ but doesn't work for Rust. On C++ there is only a warning.
21+
-- opts.capabilities.offsetEncoding = "utf-8"
2122
end
2223
lspconfig[lsp].setup(opts)
2324
end

nvchad-v2.0/plugins.lua

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ local overrides = require("custom.configs.overrides")
44
local plugins = {
55

66
-- Override plugin definition options
7+
-- {
8+
-- "nvim-telescope/telescope.nvim",
9+
-- config = function()
10+
-- require("jabs").setup {
11+
-- defaults = { file_ignore_patterns = { "^./.git/", "^node_modules/", "^vendor/", "^target/" } }
12+
-- }
13+
-- end,
14+
-- },
715

816
{
917
"neovim/nvim-lspconfig",

nvchad-v2.5/init.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ require("lazy").setup({
2828
{ import = "plugins" },
2929
}, lazy_config)
3030

31-
-- load theme
3231
dofile(vim.g.base46_cache .. "defaults")
3332
dofile(vim.g.base46_cache .. "statusline")
3433

35-
require "nvchad.autocmds"
34+
require "autocmds"
35+
require "utils.autosave"
3636

3737
vim.schedule(function()
3838
require "mappings"

nvchad-v2.5/lazy-lock.json

Lines changed: 29 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,33 @@
11
{
2-
"ChatGPT.nvim": { "branch": "main", "commit": "df53728e05129278d6ea26271ec086aa013bed90" },
3-
"Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" },
4-
"LuaSnip": { "branch": "master", "commit": "825a61bad1d60d917a7962d73cf3c683f4e0407e" },
5-
"NvChad": { "branch": "v2.5", "commit": "6833c60694a626615911e379d201dd723511546d" },
6-
"base46": { "branch": "v2.5", "commit": "adb64a6ae70f8c61c5ab8892f07d29dafd4d47ad" },
2+
"ChatGPT.nvim": { "branch": "main", "commit": "5b6d296eefc75331e2ff9f0adcffbd7d27862dd6" },
3+
"LuaSnip": { "branch": "master", "commit": "c9b9a22904c97d0eb69ccb9bab76037838326817" },
4+
"NvChad": { "branch": "v2.5", "commit": "6f25b2739684389ca69ea8229386c098c566c408" },
5+
"base46": { "branch": "v3.0", "commit": "59566882e09a8a77dbdb33b678a93680c36ae089" },
76
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
8-
"cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" },
7+
"cmp-nvim-lsp": { "branch": "main", "commit": "99290b3ec1322070bcfb9e846450a46f6efa50f0" },
98
"cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" },
109
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
11-
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
12-
"conform.nvim": { "branch": "master", "commit": "9d5ba06d6ee7418c674f498634617416d15b6239" },
13-
"friendly-snippets": { "branch": "main", "commit": "ea068f1becd91bcd4591fceb6420d4335e2e14d3" },
14-
"gitsigns.nvim": { "branch": "main", "commit": "fa052c20aa7cc62ce6a328c7f3bd556c93b5370e" },
15-
"indent-blankline.nvim": { "branch": "master", "commit": "3d08501caef2329aba5121b753e903904088f7e6" },
16-
"lazy.nvim": { "branch": "main", "commit": "bef521ac89c8d423f9d092e37b58e8af0c099309" },
17-
"mason.nvim": { "branch": "main", "commit": "751b1fcbf3d3b783fcf8d48865264a9bcd8f9b10" },
18-
"nui.nvim": { "branch": "main", "commit": "cbd2668414331c10039278f558630ed19b93e69b" },
19-
"nvim-autopairs": { "branch": "master", "commit": "dbfc1c34bed415906395db8303c71039b3a3ffb4" },
20-
"nvim-cmp": { "branch": "main", "commit": "ce16de5665c766f39c271705b17fff06f7bcb84f" },
21-
"nvim-colorizer.lua": { "branch": "master", "commit": "85855b38011114929f4058efc97af1059ab3e41d" },
22-
"nvim-lspconfig": { "branch": "master", "commit": "96e5711040df23583591391ce49e556b8cd248d8" },
23-
"nvim-tree.lua": { "branch": "master", "commit": "d8d3a1590a05b2d8b5eb26e2ed1c6052b1b47a77" },
24-
"nvim-treesitter": { "branch": "master", "commit": "1b050206e490a4146cdf25c7b38969c1711b5620" },
25-
"nvim-web-devicons": { "branch": "master", "commit": "3ee60deaa539360518eaab93a6c701fe9f4d82ef" },
26-
"plenary.nvim": { "branch": "master", "commit": "8aad4396840be7fc42896e3011751b7609ca4119" },
27-
"telescope.nvim": { "branch": "master", "commit": "4626aaa2bcfdacf55fd6d44b430e2df81b2403ff" },
28-
"trouble.nvim": { "branch": "main", "commit": "b9cf677f20bb2faa2dacfa870b084e568dca9572" },
29-
"ui": { "branch": "v2.5", "commit": "e1af69426b3c4b55c88bd1c81790c1c73b30bfa8" },
30-
"which-key.nvim": { "branch": "main", "commit": "4433e5ec9a507e5097571ed55c02ea9658fb268a" }
31-
}
10+
"cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
11+
"codecompanion.nvim": { "branch": "main", "commit": "3b41af8ea3c858711cdc6f7589e2708d61f4948d" },
12+
"conform.nvim": { "branch": "master", "commit": "f9ef25a7ef00267b7d13bfc00b0dea22d78702d5" },
13+
"friendly-snippets": { "branch": "main", "commit": "efff286dd74c22f731cdec26a70b46e5b203c619" },
14+
"gitsigns.nvim": { "branch": "main", "commit": "7010000889bfb6c26065e0b0f7f1e6aa9163edd9" },
15+
"indent-blankline.nvim": { "branch": "master", "commit": "005b56001b2cb30bfa61b7986bc50657816ba4ba" },
16+
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
17+
"mason.nvim": { "branch": "main", "commit": "fc98833b6da5de5a9c5b1446ac541577059555be" },
18+
"menu": { "branch": "main", "commit": "7769b17c2a131108c02b10e9f844e504aa605cc2" },
19+
"minty": { "branch": "main", "commit": "aafc9e8e0afe6bf57580858a2849578d8d8db9e0" },
20+
"nui.nvim": { "branch": "main", "commit": "8d3bce9764e627b62b07424e0df77f680d47ffdb" },
21+
"nvim-autopairs": { "branch": "master", "commit": "6522027785b305269fa17088395dfc0f456cedd2" },
22+
"nvim-cmp": { "branch": "main", "commit": "1e1900b0769324a9675ef85b38f99cca29e203b3" },
23+
"nvim-lspconfig": { "branch": "master", "commit": "fb733ac734249ccf293e5c8018981d4d8f59fa8f" },
24+
"nvim-tree.lua": { "branch": "master", "commit": "44d9b58f11d5a426c297aafd0be1c9d45617a849" },
25+
"nvim-treesitter": { "branch": "master", "commit": "20a7e40203dab3454686e057adecd805f3d6d334" },
26+
"nvim-web-devicons": { "branch": "master", "commit": "4c3a5848ee0b09ecdea73adcd2a689190aeb728c" },
27+
"plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" },
28+
"telescope.nvim": { "branch": "master", "commit": "a4ed82509cecc56df1c7138920a1aeaf246c0ac5" },
29+
"trouble.nvim": { "branch": "main", "commit": "85bedb7eb7fa331a2ccbecb9202d8abba64d37b3" },
30+
"ui": { "branch": "v3.0", "commit": "75233833d84b930bc37fecdcd7eb73b5714e92e4" },
31+
"volt": { "branch": "main", "commit": "21a2351697abfed26d4469b88d3ab124d55a1b3f" },
32+
"which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" }
33+
}

0 commit comments

Comments
 (0)