diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..f5ffe36 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,48 @@ +# Use the official image as a parent image +FROM ubuntu:24.04 + +# Install dependencies +RUN apt-get update && \ + apt-get install -y \ + git \ + curl \ + python3 \ + python3-pip \ + neovim \ + nodejs \ + npm \ + lua5.4 \ + golang \ + docker.io \ + kubectl \ + k9s \ + tmux \ + gnupg \ + openjdk-17-jdk \ + fzf \ + bat \ + ripgrep \ + && apt-get clean + +# Install 1Password CLI +RUN curl -sS https://downloads.1password.com/linux/debian/amd64/stable/1password-latest.deb -o 1password-latest.deb && \ + apt install ./1password-latest.deb && \ + rm 1password-latest.deb + +# Install pip packages +RUN pip3 install virtualenvwrapper + +# Create a non-root user and switch to it +RUN useradd -ms /bin/bash devuser +USER devuser +WORKDIR /home/devuser + +# Clone the dotfiles repository +RUN git clone https://github.com/dolfolife/dotfiles.git + +# Run the installation script +RUN cd dotfiles && make install + +# Set the shell to zsh +CMD ["/bin/bash"] + diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..4387c7e --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,23 @@ +{ + "name": "Dolfo's DevContainer", + "dockerFile": "Dockerfile", + "context": "..", + "settings": { + "terminal.integrated.shell.linux": "/bin/bash" + }, + "extensions": [ + "ms-python.python", + "ms-vscode.cpptools", + "ms-azuretools.vscode-docker", + "eamodio.gitlens", + "esbenp.prettier-vscode", + "dbaeumer.vscode-eslint", + "shardulm94.trailing-spaces" + ], + "postCreateCommand": "cd ~/dotfiles && ./install.sh", + "remoteUser": "dolfo", + "mounts": [ + "source=${localEnv:HOME}/.ssh,target=/home/devuser/.ssh,type=bind,consistency=cached", + "source=${localEnv:HOME}/.gitconfig,target=/home/devuser/.gitconfig,type=bind,consistency=cached" + ] +} diff --git a/.gitignore b/.gitignore index 53e1449..0279153 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ -nvim/plugin/packer_compiled.lua -nvim/pack +common/nvim/plugin/packer_compiled.lua +common/nvim/pack +*.tar.gz diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..d4e8556 --- /dev/null +++ b/Makefile @@ -0,0 +1,29 @@ + +# Install Dependencies +.PHONY: install +install: install.sh + ./install.sh + +.PHONY: install-personal +install-personal: install.sh + ./install.sh --full + +# Help target +.PHONY: help +help: + @echo "Available targets:" + @echo " make - Run the default install target" + @echo " make install - Install dependencies" + @echo " make install-personal - Install dependencies for personal projects" + @echo " make help - Display this help message" + @echo " make devcontainer - Build and run the dev container" + +# Target for running in a dev container +.PHONY: devcontainer +devcontainer: .devcontainer/Dockerfile .devcontainer/devcontainer.json + @echo "Building and running the dev container..." + docker build -t devcontainer -f .devcontainer/Dockerfile . + docker run -it --rm --name devcontainer \ + -v ${HOME}/.ssh:/home/devuser/.ssh \ + -v ${HOME}/.gitconfig:/home/devuser/.gitconfig \ + devcontainer diff --git a/README.md b/README.md index 4b8443a..f2676d8 100644 --- a/README.md +++ b/README.md @@ -1,26 +1,28 @@ -# workspace Configuration -Simple zsh scripts for my terminal +# Dotfiles -# Install +This is a group of scripts I use to maintain order and consistency across the environments I use code. +## Usage + +```bash +git clone https://github.com/dolfolife/dotfiles.git ~/dotfiles +cd ~/dotfiles +make help ``` -Warning: If you want to give these scripts a try, you should first fork this -repository, review the code, and remove things you don’t want or need. Don’t -blindly use my settings unless you know what that entails. Use at your own -risk! -``` -- open **Terminal**, load your SSH key and run - ``` - sudo xcodebuild -license # follow the interactive prompts - git clone -–depth 1 https://github.com/dolfolife/dotfiles - cd dotfiles - - ./install.sh - ``` - -## patterns and assumptions -- Keep it simple -- Declarative and idempotent -- Install as much as possible via brew +## Architecture + +There are options for MacOS, Ubuntu (WSL), Windows Powershell, and Cygwin. +The install scripts should run the right set of scripts based on the `$OSTYPE` environment variable. + + +## Modes +There are a set of extra information depending on the workstation I use. +For example, I add 1password and the personal GPG key in personal computers. +For this, I separated the levels of install you can work and add your own wrapper. + +```bash +make install DOMAIN= +``` +> Note: make sure `company.domain` folder is at the root of your dotfiles diff --git a/gitconfig b/common/.gitconfig similarity index 97% rename from gitconfig rename to common/.gitconfig index 1108772..291fa93 100644 --- a/gitconfig +++ b/common/.gitconfig @@ -36,5 +36,5 @@ [status] submoduleSummary = true [user] - email = rodolfo2488@gmail.com + email = me@dolfo.codes name = Rodolfo Sanchez diff --git a/common/common-setup.sh b/common/common-setup.sh new file mode 100644 index 0000000..6b0d295 --- /dev/null +++ b/common/common-setup.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +# Set the gitconfig +cp ~/dotfiles/common/.gitconfig ~/.gitconfig + +echo $VAULT +echo $INCLUDE_GPG diff --git a/nvim/after/plugin/colors.lua b/common/nvim/after/plugin/colors.lua similarity index 100% rename from nvim/after/plugin/colors.lua rename to common/nvim/after/plugin/colors.lua diff --git a/nvim/after/plugin/copilot.lua b/common/nvim/after/plugin/copilot.lua similarity index 100% rename from nvim/after/plugin/copilot.lua rename to common/nvim/after/plugin/copilot.lua diff --git a/nvim/after/plugin/fugitive.lua b/common/nvim/after/plugin/fugitive.lua similarity index 100% rename from nvim/after/plugin/fugitive.lua rename to common/nvim/after/plugin/fugitive.lua diff --git a/nvim/after/plugin/gitsigns.lua b/common/nvim/after/plugin/gitsigns.lua similarity index 100% rename from nvim/after/plugin/gitsigns.lua rename to common/nvim/after/plugin/gitsigns.lua diff --git a/nvim/after/plugin/go.lua b/common/nvim/after/plugin/go.lua similarity index 100% rename from nvim/after/plugin/go.lua rename to common/nvim/after/plugin/go.lua diff --git a/nvim/after/plugin/harpoon.lua b/common/nvim/after/plugin/harpoon.lua similarity index 100% rename from nvim/after/plugin/harpoon.lua rename to common/nvim/after/plugin/harpoon.lua diff --git a/nvim/after/plugin/lsp.lua b/common/nvim/after/plugin/lsp.lua similarity index 99% rename from nvim/after/plugin/lsp.lua rename to common/nvim/after/plugin/lsp.lua index 3c59909..0a43720 100644 --- a/nvim/after/plugin/lsp.lua +++ b/common/nvim/after/plugin/lsp.lua @@ -7,7 +7,6 @@ lsp.ensure_installed({ 'kotlin_language_server', 'lua_ls', 'gradle_ls', - 'hls', 'jsonls', 'eslint', 'pyright', diff --git a/nvim/after/plugin/telescope.lua b/common/nvim/after/plugin/telescope.lua similarity index 100% rename from nvim/after/plugin/telescope.lua rename to common/nvim/after/plugin/telescope.lua diff --git a/nvim/after/plugin/treesitter.lua b/common/nvim/after/plugin/treesitter.lua similarity index 100% rename from nvim/after/plugin/treesitter.lua rename to common/nvim/after/plugin/treesitter.lua diff --git a/nvim/after/plugin/trouble.lua b/common/nvim/after/plugin/trouble.lua similarity index 100% rename from nvim/after/plugin/trouble.lua rename to common/nvim/after/plugin/trouble.lua diff --git a/nvim/after/plugin/undotree.lua b/common/nvim/after/plugin/undotree.lua similarity index 100% rename from nvim/after/plugin/undotree.lua rename to common/nvim/after/plugin/undotree.lua diff --git a/nvim/after/plugin/zenmode.lua b/common/nvim/after/plugin/zenmode.lua similarity index 100% rename from nvim/after/plugin/zenmode.lua rename to common/nvim/after/plugin/zenmode.lua diff --git a/nvim/init.lua b/common/nvim/init.lua similarity index 100% rename from nvim/init.lua rename to common/nvim/init.lua diff --git a/common/nvim/init.vim b/common/nvim/init.vim new file mode 120000 index 0000000..f6dcd20 --- /dev/null +++ b/common/nvim/init.vim @@ -0,0 +1 @@ +/home/autonomo/dotfiles/ubuntu/init.vim \ No newline at end of file diff --git a/nvim/lua/dolfo/init.lua b/common/nvim/lua/dolfo/init.lua similarity index 100% rename from nvim/lua/dolfo/init.lua rename to common/nvim/lua/dolfo/init.lua diff --git a/nvim/lua/dolfo/nvim.appimage b/common/nvim/lua/dolfo/nvim.appimage similarity index 58% rename from nvim/lua/dolfo/nvim.appimage rename to common/nvim/lua/dolfo/nvim.appimage index eca65f7..f7ee33d 100755 Binary files a/nvim/lua/dolfo/nvim.appimage and b/common/nvim/lua/dolfo/nvim.appimage differ diff --git a/nvim/lua/dolfo/packer.lua b/common/nvim/lua/dolfo/packer.lua similarity index 98% rename from nvim/lua/dolfo/packer.lua rename to common/nvim/lua/dolfo/packer.lua index 53564f8..1cf73aa 100644 --- a/nvim/lua/dolfo/packer.lua +++ b/common/nvim/lua/dolfo/packer.lua @@ -13,7 +13,7 @@ return require('packer').startup(function(use) as = 'catppuccin', config = function() require("catppuccin").setup() - vim.cmd('colorscheme catppuccin') + vim.cmd.colorscheme "catppuccin" end, }) use({ diff --git a/nvim/lua/dolfo/remap.lua b/common/nvim/lua/dolfo/remap.lua similarity index 100% rename from nvim/lua/dolfo/remap.lua rename to common/nvim/lua/dolfo/remap.lua diff --git a/nvim/lua/dolfo/set.lua b/common/nvim/lua/dolfo/set.lua similarity index 100% rename from nvim/lua/dolfo/set.lua rename to common/nvim/lua/dolfo/set.lua diff --git a/common/nvim/pack/github/start/copilot.vim b/common/nvim/pack/github/start/copilot.vim new file mode 160000 index 0000000..0668308 --- /dev/null +++ b/common/nvim/pack/github/start/copilot.vim @@ -0,0 +1 @@ +Subproject commit 0668308e68b0ac28b332b204b469fbe04601536a diff --git a/common/utils.sh b/common/utils.sh new file mode 100644 index 0000000..5fbf332 --- /dev/null +++ b/common/utils.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +set +eu + +confirm() { + if [[ -n "${skip}" ]] && [[ "${skip}" == "-f" ]]; then + return + fi + + read -r -p "Are you sure? [y/N] " response + case $response in + [yY][eE][sS]|[yY]) + return + ;; + + *) + echo "Bailing out, you said no" + exit 187 + ;; + esac +} + +clone_if_not_exist() { + local remote=$1 + local dst_dir="$2" + echo "Cloning $remote into $dst_dir" + if [[ ! -d $dst_dir ]]; then + git clone "$remote" "$dst_dir" + fi +} diff --git a/install.sh b/install.sh index 5c6a2b5..2ff729b 100755 --- a/install.sh +++ b/install.sh @@ -1,178 +1,45 @@ -#!/usr/bin/env bash +#!/bin/bash +# Parse arguments +INCLUDE_GPG=false +VAULT="NONE" set -eu -skip="${1:-}" - -main() { - confirm - - install_brew - install_brew_packages - - setup_git - setup_ssh - setup_nvim - - install_gpg - install_sshb0t - - install_colorschemes - - echo "Setting keyboard repeat rates..." - defaults write -g InitialKeyRepeat -int 25 # normal minimum is 15 (225 ms) - defaults write -g KeyRepeat -int 2 # normal minimum is 2 (30 ms) - - install_tmuxfiles - - echo "workspace setup complete — open a new window to apply all settings! 🌈" -} - -clone_if_not_exist() { - local remote=$1 - local dst_dir="$2" - echo "Cloning $remote into $dst_dir" - if [[ ! -d $dst_dir ]]; then - git clone "$remote" "$dst_dir" - fi -} - -confirm() { - if [[ -n "${skip}" ]] && [[ "${skip}" == "-f" ]]; then - return - fi - - read -r -p "Are you sure? [y/N] " response - case $response in - [yY][eE][sS]|[yY]) - return - ;; - - *) - echo "Bailing out, you said no" - exit 187 - ;; - esac -} - -install_brew() { - set +e - echo "Install Hombrew..." - if [[ -z "$(brew -v)" ]]; then - /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" - fi - - set -e -} - -install_brew_packages() { - set +e - - echo "Running the Brewfile..." - brew update - brew tap Homebrew/bundle - ln -sf "$(pwd)/Brewfile" "${HOME}/.Brewfile" - brew bundle --global - brew bundle cleanup - - set -e -} - -setup_git() { - - echo "Copy the zshrc file into .zshrc" - ln -sf "$(pwd)/zshrc" "${HOME}/.zshrc" - - echo "Copy the gitconfig file into ~/.gitconfig..." - cp -rf "$(pwd)/gitconfig" "${HOME}/.gitconfig" - - echo "Copy the inputrc file into ~/.inputrc..." - ln -sf "$(pwd)/inputrc" "${HOME}/.inputrc" -} - -setup_nvim() { - - echo "Copy the nvim folder into ~/.config/nvim ..." - ln -sf "$(pwd)/nvim" "${HOME}/.config/nvim" - - clone_if_not_exist https://github.com/wbthomason/packer.nvim "${HOME}/.local/share/nvim/site/pack/packer/start/packer.nvim" - clone_if_not_exist https://github.com/github/copilot.vim.git "${HOME}/.config/nvim/pack/github/start/copilot.vim" -} - -setup_ssh() { - echo "Setting up SSH config" - if [[ ! -d ${HOME}/.ssh ]]; then - mkdir "${HOME}/.ssh" - chmod 0700 "${HOME}/.ssh" - fi -} - -install_gpg() { - echo "Installing gpg..." - if ! [[ -d "${HOME}/.gnupg" ]]; then - mkdir "${HOME}/.gnupg" - chmod 0700 "${HOME}/.gnupg" - - cat << EOF > "${HOME}/.gnupg/gpg-agent.conf" -default-cache-ttl 3600 -pinentry-program /usr/local/bin/pinentry-mac -enable-ssh-support -EOF - - gpg-connect-agent reloadagent /bye > /dev/null - fi -} - - -install_sshb0t() { - go install github.com/genuinetools/sshb0t@latest - - echo "sshb0t installed!" - - sshb0t --once \ - --user dolfolife -} - -install_colorschemes() { - echo "Cloning colorschemes..." - clone_if_not_exist https://github.com/chriskempson/base16-shell.git "${HOME}/.config/base16-shell" -} - -install_tmuxfiles() { - set +e - tmux list-sessions # this exits 1 if there are no sessions - - if [ $? -eq 0 ]; then - echo "If you'd like to update your tmux files, please kill all of your tmux sessions and run this script again." - exit 1 - else - mkdir -p ~/.tmux/plugins/ - - if [[ -f ~/.tmux.conf && "$(readlink -f ~/.tmux.conf)" != "$(pwd)/tmux.conf" ]]; then - echo -n "Existing ~/.tmux.conf found. Overwrite? (y/N) " - read -r response - if [[ "${response}" == "y" ]]; then - rm -f ~/.tmux.conf - else - echo "${RED}Installation aborted.${END_COLOR}" - exit 1 - fi - fi - - if [[ ! -L ~/.tmux.conf ]]; then - ln -s "$(pwd)/tmux.conf" ~/.tmux.conf - fi - - if [[ ! -d ~/.tmux/plugins/tpm ]]; then - git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm - fi - - ~/.tmux/plugins/tpm/bin/install_plugins - ~/.tmux/plugins/tpm/bin/update_plugins all - ~/.tmux/plugins/tpm/bin/clean_plugins - +for arg in "$@"; do + case $arg in + --include-gpg) + INCLUDE_GPG=true + shift # Remove --include-gpg from processing + ;; + esac + case $arg in + --vault-1password) + VAULT="1password" + shift # Remove --vault from processing + ;; + esac +done + +source ./common/utils.sh + +confirm + +source ./common/common-setup.sh + +if [[ "$OSTYPE" == "linux-gnu"* ]]; then + if [[ -f /etc/lsb-release ]]; then + source ./ubuntu/ubuntu-setup.sh fi - set -e -} +elif [[ "$OSTYPE" == "darwin"* ]]; then + source ./macos/macos-setup.sh +elif [[ "$OSTYPE" == "cygwin" ]]; then + echo "Cygwin is not fully supported. Please use native PowerShell scripts." +elif [[ "$OSTYPE" == "msys" ]]; then + echo "Git Bash is not fully supported. Please use native PowerShell scripts." +elif [[ "$OSTYPE" == "win32" ]]; then + ./windows/PowerShell/windows-setup.ps1 +else + echo "Unknown OS type: $OSTYPE" +fi + -main "$@" diff --git a/inputrc b/macos/.inputrc similarity index 100% rename from inputrc rename to macos/.inputrc diff --git a/zshrc b/macos/.zshrc similarity index 100% rename from zshrc rename to macos/.zshrc diff --git a/Brewfile b/macos/Brewfile similarity index 100% rename from Brewfile rename to macos/Brewfile diff --git a/macos/macos-setup.sh b/macos/macos-setup.sh new file mode 100755 index 0000000..db6fd42 --- /dev/null +++ b/macos/macos-setup.sh @@ -0,0 +1,130 @@ +#!/usr/bin/env bash + +set -eu + +skip="${1:-}" + +main() { + + install_brew + install_brew_packages + + setup_git + setup_ssh + setup_nvim + + install_gpg + install_sshb0t + + install_colorschemes + + echo "Setting keyboard repeat rates..." + defaults write -g InitialKeyRepeat -int 25 # normal minimum is 15 (225 ms) + defaults write -g KeyRepeat -int 2 # normal minimum is 2 (30 ms) + + install_tmuxfiles + + echo "workspace setup complete — open a new window to apply all settings! 🌈" +} + +install_brew() { + set +e + echo "Installing Hombrew..." + if [[ -z "$(brew -v)" ]]; then + /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" + fi + echo "Done installing Hombrew..." + set -e +} + +install_brew_packages() { + set +e + echo "Running the Brewfile..." + brew update + brew tap Homebrew/bundle + ln -sf "${HOME}/dotfiles/macos/Brewfile" "${HOME}/.Brewfile" + brew bundle --global + brew bundle cleanup + + echo "Done with the Brewfile..." + set -e +} + +setup_git() { + + echo "Copy the zshrc file into .zshrc" + ln -sf "$(pwd)/zshrc" "${HOME}/.zshrc" + + echo "Copy the inputrc file into ~/.inputrc..." + ln -sf "$(pwd)/inputrc" "${HOME}/.inputrc" +} + +install_gpg() { + echo "Installing gpg..." + if ! [[ -d "${HOME}/.gnupg" ]]; then + mkdir "${HOME}/.gnupg" + chmod 0700 "${HOME}/.gnupg" + + cat << EOF > "${HOME}/.gnupg/gpg-agent.conf" +default-cache-ttl 3600 +pinentry-program /usr/local/bin/pinentry-mac +enable-ssh-support +EOF + + gpg-connect-agent reloadagent /bye > /dev/null + fi +} + + +install_sshb0t() { + go install github.com/genuinetools/sshb0t@latest + + echo "sshb0t installed!" + + sshb0t --once \ + --user dolfolife +} + +install_colorschemes() { + echo "Cloning colorschemes..." + clone_if_not_exist https://github.com/chriskempson/base16-shell.git "${HOME}/.config/base16-shell" +} + +install_tmuxfiles() { + set +e + tmux list-sessions # this exits 1 if there are no sessions + + if [ $? -eq 0 ]; then + echo "If you'd like to update your tmux files, please kill all of your tmux sessions and run this script again." + exit 1 + else + mkdir -p ~/.tmux/plugins/ + + if [[ -f ~/.tmux.conf && "$(readlink -f ~/.tmux.conf)" != "$(HOME)/dotfiles/macos/.tmux.conf" ]]; then + echo -n "Existing ~/.tmux.conf found. Overwrite? (y/N) " + read -r response + if [[ "${response}" == "y" ]]; then + rm -f ~/.tmux.conf + else + echo "${RED}Installation aborted.${END_COLOR}" + exit 1 + fi + fi + + if [[ ! -L ~/.tmux.conf ]]; then + ln -s "$HOME/dotfiles/macos/.tmux.conf" ~/.tmux.conf + fi + + if [[ ! -d ~/.tmux/plugins/tpm ]]; then + git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm + fi + + ~/.tmux/plugins/tpm/bin/install_plugins + ~/.tmux/plugins/tpm/bin/update_plugins all + ~/.tmux/plugins/tpm/bin/clean_plugins + + fi + set -e +} + +main "$@" diff --git a/ubuntu/.bashrc b/ubuntu/.bashrc new file mode 100644 index 0000000..f5ffeb9 --- /dev/null +++ b/ubuntu/.bashrc @@ -0,0 +1,123 @@ +# ~/.bashrc: executed by bash(1) for non-login shells. +# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) +# for examples + +# If not running interactively, don't do anything +case $- in + *i*) ;; + *) return;; +esac + +# don't put duplicate lines or lines starting with space in the history. +# See bash(1) for more options +HISTCONTROL=ignoreboth + +# append to the history file, don't overwrite it +shopt -s histappend + +# for setting history length see HISTSIZE and HISTFILESIZE in bash(1) +HISTSIZE=1000 +HISTFILESIZE=2000 + +# check the window size after each command and, if necessary, +# update the values of LINES and COLUMNS. +shopt -s checkwinsize + +# If set, the pattern "**" used in a pathname expansion context will +# match all files and zero or more directories and subdirectories. +#shopt -s globstar + +# make less more friendly for non-text input files, see lesspipe(1) +[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" + +# set variable identifying the chroot you work in (used in the prompt below) +if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then + debian_chroot=$(cat /etc/debian_chroot) +fi + +# set a fancy prompt (non-color, unless we know we "want" color) +case "$TERM" in + xterm-color|*-256color) color_prompt=yes;; +esac + +# uncomment for a colored prompt, if the terminal has the capability; turned +# off by default to not distract the user: the focus in a terminal window +# should be on the output of commands, not on the prompt +#force_color_prompt=yes + +if [ -n "$force_color_prompt" ]; then + if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then + # We have color support; assume it's compliant with Ecma-48 + # (ISO/IEC-6429). (Lack of such support is extremely rare, and such + # a case would tend to support setf rather than setaf.) + color_prompt=yes + else + color_prompt= + fi +fi + +if [ "$color_prompt" = yes ]; then + PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' +else + PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' +fi +unset color_prompt force_color_prompt + +# If this is an xterm set the title to user@host:dir +case "$TERM" in +xterm*|rxvt*) + PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1" + ;; +*) + ;; +esac + +# enable color support of ls and also add handy aliases +if [ -x /usr/bin/dircolors ]; then + test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" + alias ls='ls --color=auto' + #alias dir='dir --color=auto' + #alias vdir='vdir --color=auto' + + alias grep='grep --color=auto' + alias fgrep='fgrep --color=auto' + alias egrep='egrep --color=auto' +fi + +# colored GCC warnings and errors +#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01' + +# some more ls aliases +alias ll='ls -alF' +alias la='ls -A' +alias l='ls -CF' +alias vim='nvim' +# Add an "alert" alias for long running commands. Use like so: +# sleep 10; alert +alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"' + +# Alias definitions. +# You may want to put all your additions into a separate file like +# ~/.bash_aliases, instead of adding them here directly. +# See /usr/share/doc/bash-doc/examples in the bash-doc package. + +if [ -f ~/.bash_aliases ]; then + . ~/.bash_aliases +fi + +# enable programmable completion features (you don't need to enable +# this, if it's already enabled in /etc/bash.bashrc and /etc/profile +# sources /etc/bash.bashrc). +if ! shopt -oq posix; then + if [ -f /usr/share/bash-completion/bash_completion ]; then + . /usr/share/bash-completion/bash_completion + elif [ -f /etc/bash_completion ]; then + . /etc/bash_completion + fi +fi + +export NVM_DIR="$HOME/.nvm" +[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm +[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion +PATH=$PATH:/usr/local/go/bin +PATH="$PATH:/opt/nvim/" diff --git a/tmux.conf b/ubuntu/.tmux.conf similarity index 100% rename from tmux.conf rename to ubuntu/.tmux.conf diff --git a/ubuntu/apt-packages.txt b/ubuntu/apt-packages.txt new file mode 100644 index 0000000..5eae03b --- /dev/null +++ b/ubuntu/apt-packages.txt @@ -0,0 +1,20 @@ +bat +docker.io +fuse +fzf +git +gnupg +snapd +libfribidi0 +libfuse2 +libopengl0 +lua5.4 +nodejs +npm +openjdk-17-jdk +python3 +python3-pip +python3-neovim +ripgrep +tmux +virtualenvwrapper diff --git a/ubuntu/install-golang.sh b/ubuntu/install-golang.sh new file mode 100644 index 0000000..9f7ccc5 --- /dev/null +++ b/ubuntu/install-golang.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +curl -LO https://dl.google.com/go/go1.22.4.linux-amd64.tar.gz +sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf go1.22.4.linux-amd64.tar.gz diff --git a/ubuntu/install-neovim.sh b/ubuntu/install-neovim.sh new file mode 100644 index 0000000..efc8524 --- /dev/null +++ b/ubuntu/install-neovim.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +curl -LO https://github.com/neovim/neovim/releases/latest/download/nvim.appimage + +chmod u+x nvim.appimage +sudo mkdir -p /opt/nvim +sudo mv nvim.appimage /opt/nvim/nvim diff --git a/ubuntu/snap-classic-packages.txt b/ubuntu/snap-classic-packages.txt new file mode 100644 index 0000000..4eb4f5f --- /dev/null +++ b/ubuntu/snap-classic-packages.txt @@ -0,0 +1 @@ +kubectl diff --git a/ubuntu/snap-packages.txt b/ubuntu/snap-packages.txt new file mode 100644 index 0000000..5479dc9 --- /dev/null +++ b/ubuntu/snap-packages.txt @@ -0,0 +1 @@ +k9s diff --git a/ubuntu/ubuntu-setup.sh b/ubuntu/ubuntu-setup.sh new file mode 100644 index 0000000..b1ffe7d --- /dev/null +++ b/ubuntu/ubuntu-setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +echo "ubuntu setup..." + +# Append extra OS specific gitconfig +cat ~/dotfiles/ubuntu/.gitconfig >> ~/.gitconfig + +# Update and install packages +sudo apt update +xargs sudo apt install -y < ~/dotfiles/ubuntu/apt-packages.txt +xargs sudo snap install --classic < ~/dotfiles/ubuntu/snap-classic-packages.txt +xargs sudo snap install < ~/dotfiles/ubuntu/snap-packages.txt + +source ~/dotfiles/ubuntu/install-golang.sh +source ~/dotfiles/ubuntu/install-neovim.sh + +# Symlink dotfiles +ln -sf ~/dotfiles/ubuntu/.bashrc ~/.bashrc +ln -sf ~/dotfiles/ubuntu/.tmux.conf ~/.tmux.conf +ln -sf ~/dotfiles/ubuntu/init.vim ~/.config/nvim/init.vim +ln -sf ~/dotfiles/common/nvim "${HOME}/.config/nvim" + +clone_if_not_exist https://github.com/wbthomason/packer.nvim "${HOME}/.local/share/nvim/site/pack/packer/start/packer.nvim" +clone_if_not_exist https://github.com/github/copilot.vim.git "${HOME}/.config/nvim/pack/github/start/copilot.vim" + +# Check if GPG setup is included +if [ "$INCLUDE_GPG" = true ]; then + echo "Including GPG and 1Password setup..." + # Source 1Password setup script + source ~/dotfiles/1password-setup.sh +fi + +# Install Python development environment tools +pip install virtualenvwrapper