diff --git a/README.md b/README.md index cd2591b..f0fb25a 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ During the installation you can configure git by embedded configurator: - code signing ```sh -sh -c "$(curl -fsSL https://ivabus.dev/dotfiles)" +sh <(curl https://ivabus.dev/dotfiles) ``` ### Upgrading dotfiles @@ -29,3 +29,11 @@ Just run `upgrade_dotfiles` in your shell. Script will `git pull`, then relink o #![screenshot-2022-12-08_18-08-29](https://user-images.githubusercontent.com/71599788/206481983-5dac2d62-5aea-4ccf-990a-b9ee6d53422f.png) [Repo Packages](https://ivabus.dev/pkgs), [AUR packages](https://ivabus.dev/aur). + +## Environment + +TODO: description + +```sh +sh <(curl https://ivabus.dev/env) +``` \ No newline at end of file diff --git a/env/.zshrc b/env/.zshrc new file mode 100644 index 0000000..68b148e --- /dev/null +++ b/env/.zshrc @@ -0,0 +1,32 @@ + +export ZSH="$HOME/.env/oh-my-zsh" + +ZSH_THEME="ivabus" +ENABLE_CORRECTION="true" +plugins=(git zsh-syntax-highlighting) + +# Function to quickly show stats on systemload, usage of filesystems, usage of ram/swap and uptime +stats () { + AVLD=$(cut -d " " -f1-3 /proc/loadavg) + USEDMEM=$(free -h | grep Mem | awk '{print $3 " / " $2}') + USEDSWAP=$(free -h | grep Swap | awk '{ print $3 " / " $2}') + USEDSTRG=$(df / -h | tail -n 1 | awk '{print $3}') + USEDSTRGPERC=$(df / -h | tail -n 1 | awk '{print $5}') + STRG=$(df / -h | tail -n 1 | awk '{print $2}') + USEDSTRGHOME=$(df /home -h | tail -n 1 | awk '{print $3}') + USEDSTRGPERCHOME=$(df /home -h | tail -n 1 | awk '{print $5}') + STRGHOME=$(df /home -h | tail -n 1 | awk '{print $2}') + UPTIME=$(uptime -p) + printf "\e[0;34msystem load:\e[m\t${AVLD}\n" + printf "\e[0;34musage of /:\e[m\t${USEDSTRGPERC}% (${USEDSTRG}/${STRG})\n" + printf "\e[0;34musage of /home:\e[m\t${USEDSTRGPERCHOME}% (${USEDSTRGHOME}/${STRGHOME})\n" + printf "\e[0;34mmemory usage:\e[m\t${USEDMEM}\n" + printf "\e[0;34mswap usage:\e[m\t${USEDSWAP}\n" + printf "\e[0;34muptime:\e[m\t\t${UPTIME}\n" +} + +source $ZSH/oh-my-zsh.sh +export REPORTTIME=10 +alias vi="nvim" +alias vim="nvim" +alias timestamp='date -u +%FT%TZ' diff --git a/env/nvim/init.vim b/env/nvim/init.vim new file mode 100644 index 0000000..3762d50 --- /dev/null +++ b/env/nvim/init.vim @@ -0,0 +1,17 @@ +filetype plugin indent on +set showmatch +set hlsearch +set incsearch +set autoindent +set expandtab +set tabstop=4 +set shiftwidth=4 +set number +set wildmode=longest, list +set cc=80 +syntax on +set noswapfile +set backupdir=~/.cache/vim +set completeopt=noinsert,menuone,noselect +set cursorline +set relativenumber diff --git a/tools/env.sh b/tools/env.sh new file mode 100755 index 0000000..ab3bce6 --- /dev/null +++ b/tools/env.sh @@ -0,0 +1,72 @@ +#!/bin/sh + +NC='\033[0m' +Green='\033[1;32m' +ARROW="${Green}=>${NC}" +INPUT="${Green}::${NC}" + +echo "${ARROW} This script will create small environment" +echo " with dotfiles from ivabus/ivabus-dotfiles" +echo "${INPUT} Press enter to continue" +read + +echo "${ARROW} Installing env to ~/.env" +mkdir -p ~/.env/bin > /dev/null 2>&1 + +TEA_PREFIX=~/.env/tea +TEA=~/.env/tea/tea.xyz/v0/bin/tea +PATH=$PATH + +echo "${ARROW} Installing static zsh" +sh -c "$(curl -fsSL https://raw.githubusercontent.com/romkatv/zsh-bin/master/install)" -q -d ~/.env -e no +PATH="$HOME/.env/bin:$PATH" + +echo "${ARROW} Installing tea" +zsh -c "sh <(curl https://tea.xyz) --prefix $TEA_PREFIX" + +echo "${ARROW} Installing neovim" +$TEA +neovim.io zsh -c "exit" +echo "${ARROW} Installing htop" +$TEA +htop.dev zsh -c "exit" +echo "${ARROW} Installing git" +$TEA +git-scm.org zsh -c "exit" +printf "${INPUT}" +read -p " Would you like to install compilers/interpretators (LLVM, Rust, Python)? (y/N): " INSTALL_COMPILERS +if [[ $INSTALL_COMPILERS == "y" || $INSTALL_COMPILERS == "Y" ]]; then + echo "${ARROW} Installing rust" + $TEA +rust-lang.org zsh -c "exit" + echo "${ARROW} Installing llvm" + $TEA +llvm.org zsh -c "exit" + echo "${ARROW} Installing python" + $TEA +python.org zsh -c "exit" +fi + +printf "${INPUT}" +read -p " Would you like to install development tools (GitHub CLI, make/cmake/meson/ninja)? (y/N): " INSTALL_TOOLS +if [[ $INSTALL_TOOLS == "y" || $INSTALL_TOOLS == "Y" ]]; then + echo "${ARROW} Installing GitHub CLI" + $TEA +cli.github.com zsh -c "exit" + echo "${ARROW} Installing make & automake & cmake & meson & ninja" + $TEA +gnu.org/make zsh -c "exit" + $TEA +gnu.org/automake zsh -c "exit" + $TEA +cmake.org zsh -c "exit" + $TEA +mesonbuild.com zsh -c "exit" + $TEA +ninja-build.org zsh -c "exit" +fi + +echo "${ARROW} Configuring \$PATH" +for i in "tea" "nvim" "clang" "clang++" "lldb" "rustc" "cargo" "htop" "make" "cmake" "automake" "meson" "ninja" "git" "gh" +do + ln -s $TEA ~/.env/bin/$i +done + +echo "${ARROW} Installing dotfiles" +git clone https://github.com/ivabus/ivabus-dotfiles ~/.env/dotfiles +ZSH="$HOME/.env/oh-my-zsh" sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended > /dev/null 2>&1 +curl -fsSL https://raw.githubusercontent.com/ivabus/ivabus-zsh-theme/master/ivabus.zsh-theme -o $HOME/.env/oh-my-zsh/custom/themes/ivabus.zsh-theme > /dev/null 2>&1 +git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $HOME/.env/oh-my-zsh/custom/plugins/zsh-syntax-highlighting > /dev/null 2>&1 +sh ~/.env/dotfiles/tools/link_env.sh + +echo "${ARROW} Environment installed to ~/.env" +echo " To start environment just type:" +echo " PATH=\"\$HOME/.env/bin:\$PATH\" zsh" \ No newline at end of file diff --git a/tools/git.sh b/tools/git.sh index 600c055..4f0ba62 100755 --- a/tools/git.sh +++ b/tools/git.sh @@ -9,7 +9,7 @@ read -p "Configure GPG signing for git? (y/N): " answer if [[ $answer = [Yy] ]]; then git config --global commit.gpgsign true - git config --global gpg.program gpg2 + git config --global gpg.program gpg read -p "Enter your GPG key ID: " GPGKEYID git config --global user.signingkey "${GPGKEYID}" else @@ -20,7 +20,7 @@ fi git config --global pull.rebase false read -p "Enter your preferred editor (default: nvim): " GITEDITOR -if [ $GITEDITOR = ""] +if [ $GITEDITOR == "" ] then GITEDITOR="nvim" fi diff --git a/tools/link_env.sh b/tools/link_env.sh new file mode 100644 index 0000000..b1765c1 --- /dev/null +++ b/tools/link_env.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +echo "=> Linking zshrc" +if [ -f ~/.zshrc ]; then + echo "=> Moving old zshrc to ~/.zshrc.old" + mv ~/.zshrc ~/.zshrc.old +fi +ln -s ~/.env/dotfiles/env/.zshrc ~/.zshrc +echo "=> Linking neovim files" +rm -rf ${XDG_CONFIG_HOME:-$HOME/.config}/nvim +ln -s ~/.env/dotfiles/nvim ${XDG_CONFIG_HOME:-$HOME/.config}/nvim diff --git a/tools/mac.sh b/tools/mac.sh index dc46479..fb9aa68 100755 --- a/tools/mac.sh +++ b/tools/mac.sh @@ -11,7 +11,7 @@ if [ "$(arch)" == "arm64" ] then HOMEBREW_PREFIX="/opt/homebrew" else - HOMEBREW_PREFIX="/usr/local/homebrew" + HOMEBREW_PREFIX="/usr/local" fi echo "eval \"\$($HOMEBREW_PREFIX/bin/brew shellenv)\"" >> $HOME/.zprofile brew install pinentry-mac gpg2