From 661ad95090749435bca91b29caa9a4af35978998 Mon Sep 17 00:00:00 2001 From: Marko Budiselic Date: Sat, 26 Apr 2025 09:55:52 +0000 Subject: [PATCH 1/3] Add Ubuntu 24.04 Server setup --- env-available/server-ubuntu-24.04/bashrc | 146 +++++++++++ env-available/server-ubuntu-24.04/setup.sh | 266 ++++++++++++++++++++ env-available/server-ubuntu-24.04/tmux.conf | 17 ++ env-enabled/server-ubuntu-24.04.sh | 1 + 4 files changed, 430 insertions(+) create mode 100644 env-available/server-ubuntu-24.04/bashrc create mode 100755 env-available/server-ubuntu-24.04/setup.sh create mode 100644 env-available/server-ubuntu-24.04/tmux.conf create mode 120000 env-enabled/server-ubuntu-24.04.sh diff --git a/env-available/server-ubuntu-24.04/bashrc b/env-available/server-ubuntu-24.04/bashrc new file mode 100644 index 0000000..36134d1 --- /dev/null +++ b/env-available/server-ubuntu-24.04/bashrc @@ -0,0 +1,146 @@ +# ~/.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' + +# 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 +source /home/buda/.local/ssh-agent-setup +source /home/buda/.bash_aliases +. "$HOME/.cargo/env" + +[ -f ~/.fzf.bash ] && source ~/.fzf.bash +PATH=$PATH:/home/buda/scripts/util +PATH=$PATH:/home/buda/scripts/workspace + +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:/home/buda/scripts/git + +# Add git branch if its present to PS1 +parse_git_branch() { + git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/' +} +return_emoji() { + # Don't pollute the return value in case we use it for something else + local _return_value="$?" + if ((_return_value == 0)); then + echo -n $'\U1F680' # 🚀 + else + echo -n $'\U1F4A5' # 💥 + fi + return "$_return_value" +} +# For some reason return emoji only works if it's at the beginning of PS1 +export PS1=' $(return_emoji) '"\u@\h \[\033[32m\]\w\[\033[33m\] \$(parse_git_branch)\[\033[00m\] $ " diff --git a/env-available/server-ubuntu-24.04/setup.sh b/env-available/server-ubuntu-24.04/setup.sh new file mode 100755 index 0000000..5870b68 --- /dev/null +++ b/env-available/server-ubuntu-24.04/setup.sh @@ -0,0 +1,266 @@ +#!/bin/bash -e +script_dir="$( cd "$(dirname "$([ -L "$0" ] && readlink -f "$0" || echo "$0")")" && pwd)" +# shellcheck disable=SC1090 +source "$script_dir/../../util/os_util" + +RM_DEPS=( + # rm_neovim + # rm_nvchad + # rm_fzf + # rm_custom-conda +) +DEPS=( + htop tmux vim tree curl git tig dialog silversearcher-ag zsh plocate + make cmake cmake-curses-gui libssl-dev pkg-config libtool-bin unzip gettext + ripgrep + exuberant-ctags + python3-dbg python3.12-venv + openjdk-17-jre + ansible + memtester + heaptrack + sysstat iotop nvtop + # custom-neovim custom-nvchad + # custom-fzf + # custom-nvm + # custom-rust + # nvidia-cuda-toolkit + # custom-cudnn custom-nccl custom-cutensor custom-cusparselt + # custom-just # https://just.systems/man/en/chapter_4.html -> cargo install just + # custom-mevi # https://github.com/fasterthanlime/mevi + # sudo sysctl -w vm.unprivileged_userfaultfd=1 + # cargo install just trunk + # cargo-tree-sitter + # custom-conda + # nvidia-cuda-toolkit # custom-cuda +) +# TODO(gitbuda): Add e.g. https://github.com/leehblue/texpander + +function rm_neovim { + echo "Removing neovim" + rm -rf $script_dir/neovim +} + +function rm_nvchad { + echo "Removing nvchad" + rm -rf $1/.config/nvim + rm -rf $1/.local/share/nvim + rm -rf $1/.cache/nvim +} + +function rm_fzf { + echo "Removing fzf" + rm -rf $1/.fzf +} + +function rm_custom-conda { + echo "Removing custom-conda" + rm -rf $1/miniconda3 +} + +if [ "$EUID" -ne 0 ]; then + echo "Please run as root." +fi +if [ "$SUDO_USER" == "" ]; then + echo "Please run as sudo." +fi +HOME=/home/$SUDO_USER + +PUBLIC_DOTFILES="bash_aliases" +for f in ${PUBLIC_DOTFILES}; do + rm -rf "/home/$SUDO_USER/.$f" + sudo -H -u "$SUDO_USER" bash -c "ln -s ${script_dir}/../../dotfiles/$f /home/$SUDO_USER/.$f" +done + +LOCAL_DOTFILES="bashrc tmux.conf" +for f in ${LOCAL_DOTFILES}; do + rm -rf "/home/$SUDO_USER/.$f" + sudo -H -u "$SUDO_USER" bash -c "ln -s ${script_dir}/$f /home/$SUDO_USER/.$f" +done + +for rm_pkg in "${RM_DEPS[@]}"; do + "$rm_pkg" "$HOME" +done + +cd "$script_dir" +for pkg in "${DEPS[@]}"; do + # if [ "$pkg" == ]; then + # fi + + if [ "$pkg" == custom-cudnn ]; then + installed_install_path="/var/cudnn-local-repo-ubuntu2204-8.8.0.121" + cudnn_deb_packet="cudnn-local-repo-ubuntu2204-8.8.0.121_1.0-1_amd64.deb" + cudnn_gpg_path="$installed_install_path/cudnn-local-04B81517-keyring.gpg" + if [ ! -f "$cudnn_gpg_path" ]; then + curl -O -J -L "https://developer.download.nvidia.com/compute/redist/cudnn/v8.8.0/local_installers/12.0/$cudnn_deb_packet" + dpkg -i "$cudnn_deb_packet" + cp $cudnn_gpg_path /usr/share/keyrings/ + fi + if ! deb_installed "libcudnn8"; then + dpkg -i "$installed_install_path/libcudnn8_8.8.0.121-1+cuda12.0_amd64.deb" + echo "libcudnn installed" + fi + if ! deb_installed "libcudnn8-dev"; then + dpkg -i "$installed_install_path/libcudnn8-dev_8.8.0.121-1+cuda12.0_amd64.deb" + echo "libcudnn-dev installed" + fi + echo "$pkg is installed." && continue + fi + + if [ "$pkg" == custom-nccl ]; then + if [ ! -f "/usr/local/include/nccl.h" ]; then + rm -rf nccl + git clone https://github.com/NVIDIA/nccl.git + cd "$script_dir/nccl" + # NOTE: CUDA_HOME depends on how cuda is actually installed. + # NOTE: g++-10 is here because of https://github.com/NVIDIA/nccl/issues/102 + CXX=/usr/bin/g++-10 make -j src.build CUDA_HOME=/usr/lib/nvidia-cuda-toolkit + make install + cd "$script_dir" + fi + echo "$pkg is installed." && continue + fi + + if [ "$pkg" == custom-cutensor ]; then + # https://developer.nvidia.com/cutensor-downloads?target_os=Linux&target_arch=x86_64&Distribution=Ubuntu&target_version=22.04&target_type=deb_local + if ! deb_installed "libcutensor2"; then + curl -O -J -L https://developer.download.nvidia.com/compute/cutensor/2.0.0/local_installers/cutensor-local-repo-ubuntu2204-2.0.0_1.0-1_amd64.deb + dpkg -i cutensor-local-repo-ubuntu2204-2.0.0_1.0-1_amd64.deb + cp /var/cutensor-local-repo-ubuntu2204-2.0.0/cutensor-*-keyring.gpg /usr/share/keyrings/ + apt update + apt-get -y install libcutensor2 libcutensor-dev libcutensor-doc + fi + echo "$pkg is installed." && continue + fi + + if [ "$pkg" == custom-cusparselt ]; then + # https://developer.nvidia.com/cusparselt-downloads?target_os=Linux&target_arch=x86_64&Distribution=Ubuntu&target_version=22.04&target_type=deb_local + if ! deb_installed "libcusparselt0"; then + curl -O -J -L https://developer.download.nvidia.com/compute/cusparselt/0.5.2/local_installers/cusparselt-local-repo-ubuntu2204-0.5.2_1.0-1_amd64.deb + dpkg -i cusparselt-local-repo-ubuntu2204-0.5.2_1.0-1_amd64.deb + cp /var/cusparselt-local-repo-ubuntu2204-0.5.2/cusparselt-*-keyring.gpg /usr/share/keyrings/ + apt-get update + apt-get -y install libcusparselt0 libcusparselt-dev + fi + echo "$pkg is installed." && continue + fi + + if [ "$pkg" == custom-rust ]; then + if ! bin_installed "/home/$SUDO_USER/.cargo/bin/rustup"; then + sudo -H -u "$SUDO_USER" bash -c "curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh" + fi + sudo -H -u "$SUDO_USER" bash -c "/home/$SUDO_USER/.cargo/bin/rustup update" + echo "$pkg is installed." && continue + fi + + if [ "$pkg" == custom-neovim ]; then + if ! bin_installed "$script_dir/neovim/build/bin/nvim"; then + cd "$script_dir" + git clone https://github.com/neovim/neovim + cd neovim + git checkout v0.9.5 + chown -R "$SUDO_USER:$SUDO_USER" "$script_dir/neovim" + sudo -H -u "$SUDO_USER" bash -c "make CMAKE_BUILD_TYPE=Release -j4" + make install + fi + echo "$pkg is installed." && continue + fi + + if [ "$pkg" == custom-nvchad ]; then + if [ ! -d "/home/$SUDO_USER/.config/nvim" ]; then + # sudo -H -u "$SUDO_USER" bash -c "git clone git@github.com:NvChad/starter.git '/home/$SUDO_USER/.config/nvim'" + # chown -R "$SUDO_USER:$SUDO_USER" "/home/$SUDO_USER/.config/nvim" + # cd "/home/$SUDO_USER/.config/nvim" + # git checkout v2.5 + if [ ! -L "/home/$SUDO_USER/.config/nvim" ]; then + ln -s "/home/$SUDO_USER/scripts/nvchad-v2.5" "/home/$SUDO_USER/.config/nvim" + fi + fi + + echo "$pkg is installed." && continue + fi + + if [ "$pkg" == custom-nvm ]; then + if [ ! -d "/home/$SUDO_USER/.nvm" ]; then + curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | sudo -H -u "$SUDO_USER" bash + fi + echo "$pkg is installed." && continue + fi + + if [ "$pkg" == custom-tpm ]; then + tpm_repo="https://github.com/tmux-plugins/tpm" + tpm_dir="/home/$SUDO_USER/.tmux/plugins/tpm" + if [[ ! -d "${tpm_dir}" ]]; then + git clone "${tpm_repo}" "${tpm_dir}" + fi + echo "$pkg is installed." && continue + fi + + if [ "$pkg" == custom-fzf ]; then + if [ ! -d "/home/$SUDO_USER/.fzf" ]; then + git clone --depth 1 https://github.com/junegunn/fzf.git /home/$SUDO_USER/.fzf + /home/$SUDO_USER/.fzf/install + chown -R "$SUDO_USER:$SUDO_USER" "/home/$SUDO_USER/.fzf" + fi + echo "$pkg is installed." && continue + fi + + if [ "$pkg" == custom-conda ]; then + # TODO(gitbuda): Decide if it's wise to edit, e.g., bashrc -> probably not. + if [ ! -d "/home/$SUDO_USER/miniconda3" ]; then + cd "$script_dir" + wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh + # NOTE: -b stands for install in batch mode (without manual intervention). + bash miniconda.sh -b + fi + echo "$pkg is installed." && continue + fi + + if [ "$pkg" == custom-cuda ]; then + # TODO(gitbuda): Revisit how to skip custom installation. NOTE: there is also nvidia-cuda-toolkit, if here, remove the default package. + if [ ! -d "/usr/local/cuda" ]; then + cd "$script_dir" + wget https://developer.download.nvidia.com/compute/cuda/11.6.0/local_installers/cuda_11.6.0_510.39.01_linux.run -O cuda.out + sh cuda.out + fi + echo "$pkg is installed." && continue + fi + + if [ "$pkg" == cargo-tree-sitter ]; then + sudo -H -u "$SUDO_USER" bash -c "/home/$SUDO_USER/.cargo/bin/cargo install tree-sitter-cli" + echo "$pkg is installed." && continue + fi + + if ! deb_installed "$pkg"; then + apt install -y "$pkg" + fi + echo "$pkg is installed." && continue +done + +# https://wiki.archlinux.org/title/SSH_keys +ssh_agent_setup_path="$HOME/.local/ssh-agent-setup" +if [ ! -f "$ssh_agent_setup_path" ]; then + cat >"$ssh_agent_setup_path" << EOF +if ! pgrep -u "\$USER" ssh-agent > /dev/null; then + ssh-agent -t 24h > "\$HOME/.ssh/ssh-agent.env" +fi +if [[ ! -f "\$SSH_AUTH_SOCK" ]]; then + source "\$HOME/.ssh/ssh-agent.env" >/dev/null +fi +EOF +fi +if ! grep -qF "source $ssh_agent_setup_path" "$HOME/.bashrc" ; then + echo "source $ssh_agent_setup_path" >> "$HOME/.bashrc" +fi + +chown -R "$SUDO_USER:$SUDO_USER" "/home/$SUDO_USER/.config" +chown -R "$SUDO_USER:$SUDO_USER" "/home/$SUDO_USER/.cache" +if ! grep -qF "$HOME/scripts/util" "$HOME/.bashrc" ; then + echo "PATH=\$PATH:$HOME/scripts/util" >> "$HOME/.bashrc" +fi +if ! grep -qF "$HOME/scripts/workspace" "$HOME/.bashrc" ; then + echo "PATH=\$PATH:$HOME/scripts/workspace" >> "$HOME/.bashrc" +fi +if ! grep -qF "$HOME/scripts/git" "$HOME/.bashrc" ; then + echo "PATH=\$PATH:$HOME/scripts/git" >> "$HOME/.bashrc" +fi diff --git a/env-available/server-ubuntu-24.04/tmux.conf b/env-available/server-ubuntu-24.04/tmux.conf new file mode 100644 index 0000000..bf9f279 --- /dev/null +++ b/env-available/server-ubuntu-24.04/tmux.conf @@ -0,0 +1,17 @@ +## Copying Text With Mouse In TMUX +# Hold down shift key and select text with left mouse button. This will copy to +# clipboard. Then hold down the shift key again and click the middle button on +# your mouse. +setw -g mouse on +set-option -g default-terminal "screen-256color" +set-option -ga terminal-overrides ',screen-256color:Tc' +set-option -sg escape-time 10 +set-option -g focus-events on + +# Set status bar style. +# TODO(gitbuda): Make tmux color configurable per host. +set -g status-fg black #e4e4e4 #000000 +set -g status-bg colour227 #ff5f00 #ffff5f +set -g status-left-length 50 + +set -g history-limit 100000 diff --git a/env-enabled/server-ubuntu-24.04.sh b/env-enabled/server-ubuntu-24.04.sh new file mode 120000 index 0000000..15ad5fc --- /dev/null +++ b/env-enabled/server-ubuntu-24.04.sh @@ -0,0 +1 @@ +../env-available/server-ubuntu-24.04/setup.sh \ No newline at end of file From 3775390ebbdf7fc211df51cf5e5ad2d0b86e8187 Mon Sep 17 00:00:00 2001 From: Marko Budiselic Date: Sun, 27 Apr 2025 09:36:11 +0000 Subject: [PATCH 2/3] Add latest nvim and nvchad --- .../nvchad_2025-04-27/.stylua.toml | 6 +++ .../nvchad_2025-04-27/LICENSE | 24 ++++++++++ .../nvchad_2025-04-27/README.md | 9 ++++ .../nvchad_2025-04-27/init.lua | 37 +++++++++++++++ .../nvchad_2025-04-27/lazy-lock.json | 29 ++++++++++++ .../nvchad_2025-04-27/lua/chadrc.lua | 24 ++++++++++ .../nvchad_2025-04-27/lua/configs/conform.lua | 15 ++++++ .../nvchad_2025-04-27/lua/configs/lazy.lua | 47 +++++++++++++++++++ .../lua/configs/lspconfig.lua | 24 ++++++++++ .../nvchad_2025-04-27/lua/mappings.lua | 10 ++++ .../nvchad_2025-04-27/lua/options.lua | 6 +++ .../nvchad_2025-04-27/lua/plugins/init.lua | 39 +++++++++++++++ env-available/server-ubuntu-24.04/setup.sh | 23 ++++----- 13 files changed, 282 insertions(+), 11 deletions(-) create mode 100644 env-available/server-ubuntu-24.04/nvchad_2025-04-27/.stylua.toml create mode 100644 env-available/server-ubuntu-24.04/nvchad_2025-04-27/LICENSE create mode 100644 env-available/server-ubuntu-24.04/nvchad_2025-04-27/README.md create mode 100644 env-available/server-ubuntu-24.04/nvchad_2025-04-27/init.lua create mode 100644 env-available/server-ubuntu-24.04/nvchad_2025-04-27/lazy-lock.json create mode 100644 env-available/server-ubuntu-24.04/nvchad_2025-04-27/lua/chadrc.lua create mode 100644 env-available/server-ubuntu-24.04/nvchad_2025-04-27/lua/configs/conform.lua create mode 100644 env-available/server-ubuntu-24.04/nvchad_2025-04-27/lua/configs/lazy.lua create mode 100644 env-available/server-ubuntu-24.04/nvchad_2025-04-27/lua/configs/lspconfig.lua create mode 100644 env-available/server-ubuntu-24.04/nvchad_2025-04-27/lua/mappings.lua create mode 100644 env-available/server-ubuntu-24.04/nvchad_2025-04-27/lua/options.lua create mode 100644 env-available/server-ubuntu-24.04/nvchad_2025-04-27/lua/plugins/init.lua diff --git a/env-available/server-ubuntu-24.04/nvchad_2025-04-27/.stylua.toml b/env-available/server-ubuntu-24.04/nvchad_2025-04-27/.stylua.toml new file mode 100644 index 0000000..ecb6dca --- /dev/null +++ b/env-available/server-ubuntu-24.04/nvchad_2025-04-27/.stylua.toml @@ -0,0 +1,6 @@ +column_width = 120 +line_endings = "Unix" +indent_type = "Spaces" +indent_width = 2 +quote_style = "AutoPreferDouble" +call_parentheses = "None" diff --git a/env-available/server-ubuntu-24.04/nvchad_2025-04-27/LICENSE b/env-available/server-ubuntu-24.04/nvchad_2025-04-27/LICENSE new file mode 100644 index 0000000..fdddb29 --- /dev/null +++ b/env-available/server-ubuntu-24.04/nvchad_2025-04-27/LICENSE @@ -0,0 +1,24 @@ +This is free and unencumbered software released into the public domain. + +Anyone is free to copy, modify, publish, use, compile, sell, or +distribute this software, either in source code form or as a compiled +binary, for any purpose, commercial or non-commercial, and by any +means. + +In jurisdictions that recognize copyright laws, the author or authors +of this software dedicate any and all copyright interest in the +software to the public domain. We make this dedication for the benefit +of the public at large and to the detriment of our heirs and +successors. We intend this dedication to be an overt act of +relinquishment in perpetuity of all present and future rights to this +software under copyright law. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +For more information, please refer to diff --git a/env-available/server-ubuntu-24.04/nvchad_2025-04-27/README.md b/env-available/server-ubuntu-24.04/nvchad_2025-04-27/README.md new file mode 100644 index 0000000..dc0deaa --- /dev/null +++ b/env-available/server-ubuntu-24.04/nvchad_2025-04-27/README.md @@ -0,0 +1,9 @@ +**This repo is supposed to used as config by NvChad users!** + +- The main nvchad repo (NvChad/NvChad) is used as a plugin by this repo. +- So you just import its modules , like `require "nvchad.options" , require "nvchad.mappings"` +- So you can delete the .git from this repo ( when you clone it locally ) or fork it :) + +# Credits + +1) Lazyvim starter https://github.com/LazyVim/starter as nvchad's starter was inspired by Lazyvim's . It made a lot of things easier! diff --git a/env-available/server-ubuntu-24.04/nvchad_2025-04-27/init.lua b/env-available/server-ubuntu-24.04/nvchad_2025-04-27/init.lua new file mode 100644 index 0000000..0fda20c --- /dev/null +++ b/env-available/server-ubuntu-24.04/nvchad_2025-04-27/init.lua @@ -0,0 +1,37 @@ +vim.g.base46_cache = vim.fn.stdpath "data" .. "/base46/" +vim.g.mapleader = " " + +-- bootstrap lazy and all plugins +local lazypath = vim.fn.stdpath "data" .. "/lazy/lazy.nvim" + +if not vim.uv.fs_stat(lazypath) then + local repo = "https://github.com/folke/lazy.nvim.git" + vim.fn.system { "git", "clone", "--filter=blob:none", repo, "--branch=stable", lazypath } +end + +vim.opt.rtp:prepend(lazypath) + +local lazy_config = require "configs.lazy" + +-- load plugins +require("lazy").setup({ + { + "NvChad/NvChad", + lazy = false, + branch = "v2.5", + import = "nvchad.plugins", + }, + + { import = "plugins" }, +}, lazy_config) + +-- load theme +dofile(vim.g.base46_cache .. "defaults") +dofile(vim.g.base46_cache .. "statusline") + +require "options" +require "nvchad.autocmds" + +vim.schedule(function() + require "mappings" +end) diff --git a/env-available/server-ubuntu-24.04/nvchad_2025-04-27/lazy-lock.json b/env-available/server-ubuntu-24.04/nvchad_2025-04-27/lazy-lock.json new file mode 100644 index 0000000..b05dcac --- /dev/null +++ b/env-available/server-ubuntu-24.04/nvchad_2025-04-27/lazy-lock.json @@ -0,0 +1,29 @@ +{ + "LuaSnip": { "branch": "master", "commit": "c9b9a22904c97d0eb69ccb9bab76037838326817" }, + "NvChad": { "branch": "v2.5", "commit": "d5ea76925fd5750e5e1ea265d371197a6a393399" }, + "base46": { "branch": "v3.0", "commit": "80358ecdb5779b199130ed03031c34c0c2bca3fc" }, + "cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "a8912b88ce488f411177fc8aed358b04dc246d7b" }, + "cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" }, + "cmp-path": { "branch": "main", "commit": "c6635aae33a50d6010bf1aa756ac2398a2d54c32" }, + "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, + "conform.nvim": { "branch": "master", "commit": "372fc521f8421b7830ea6db4d6ea3bae1c77548c" }, + "friendly-snippets": { "branch": "main", "commit": "fc8f183479a472df60aa86f00e295462f2308178" }, + "gitsigns.nvim": { "branch": "main", "commit": "140ac646db125904e456e42ab8b538d28f9607d7" }, + "indent-blankline.nvim": { "branch": "master", "commit": "005b56001b2cb30bfa61b7986bc50657816ba4ba" }, + "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, + "mason.nvim": { "branch": "main", "commit": "fc98833b6da5de5a9c5b1446ac541577059555be" }, + "menu": { "branch": "main", "commit": "8adb036ec34c679050913864cbc98cc64eb91f6c" }, + "minty": { "branch": "main", "commit": "aafc9e8e0afe6bf57580858a2849578d8d8db9e0" }, + "nvim-autopairs": { "branch": "master", "commit": "4d74e75913832866aa7de35e4202463ddf6efd1b" }, + "nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" }, + "nvim-lspconfig": { "branch": "master", "commit": "2e74354b2752cb4980fca35c451792908c186f2f" }, + "nvim-tree.lua": { "branch": "master", "commit": "582ae48c9e43d2bcd55dfcc8e2e7a1f29065d924" }, + "nvim-treesitter": { "branch": "master", "commit": "4c7509e7b06cea99065e8d4a20d30e6a2e5cd924" }, + "nvim-web-devicons": { "branch": "master", "commit": "50b5b06bff13a9b4eab946de7c7033649a6618a1" }, + "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, + "telescope.nvim": { "branch": "master", "commit": "a4ed82509cecc56df1c7138920a1aeaf246c0ac5" }, + "ui": { "branch": "v3.0", "commit": "4466c87073c811c22b14215ba8a0cfc7d1b8b688" }, + "volt": { "branch": "main", "commit": "c45d5f48da8e802e608b5c6da471ca4d84276dfb" }, + "which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" } +} diff --git a/env-available/server-ubuntu-24.04/nvchad_2025-04-27/lua/chadrc.lua b/env-available/server-ubuntu-24.04/nvchad_2025-04-27/lua/chadrc.lua new file mode 100644 index 0000000..a75a67f --- /dev/null +++ b/env-available/server-ubuntu-24.04/nvchad_2025-04-27/lua/chadrc.lua @@ -0,0 +1,24 @@ +-- This file needs to have same structure as nvconfig.lua +-- https://github.com/NvChad/ui/blob/v3.0/lua/nvconfig.lua +-- Please read that file to know all available options :( + +---@type ChadrcConfig +local M = {} + +M.base46 = { + theme = "onedark", + + -- hl_override = { + -- Comment = { italic = true }, + -- ["@comment"] = { italic = true }, + -- }, +} + +-- M.nvdash = { load_on_startup = true } +-- M.ui = { +-- tabufline = { +-- lazyload = false +-- } +--} + +return M diff --git a/env-available/server-ubuntu-24.04/nvchad_2025-04-27/lua/configs/conform.lua b/env-available/server-ubuntu-24.04/nvchad_2025-04-27/lua/configs/conform.lua new file mode 100644 index 0000000..35ba6cf --- /dev/null +++ b/env-available/server-ubuntu-24.04/nvchad_2025-04-27/lua/configs/conform.lua @@ -0,0 +1,15 @@ +local options = { + formatters_by_ft = { + lua = { "stylua" }, + -- css = { "prettier" }, + -- html = { "prettier" }, + }, + + -- format_on_save = { + -- -- These options will be passed to conform.format() + -- timeout_ms = 500, + -- lsp_fallback = true, + -- }, +} + +return options diff --git a/env-available/server-ubuntu-24.04/nvchad_2025-04-27/lua/configs/lazy.lua b/env-available/server-ubuntu-24.04/nvchad_2025-04-27/lua/configs/lazy.lua new file mode 100644 index 0000000..cd170bd --- /dev/null +++ b/env-available/server-ubuntu-24.04/nvchad_2025-04-27/lua/configs/lazy.lua @@ -0,0 +1,47 @@ +return { + defaults = { lazy = true }, + install = { colorscheme = { "nvchad" } }, + + ui = { + icons = { + ft = "", + lazy = "󰂠 ", + loaded = "", + not_loaded = "", + }, + }, + + performance = { + rtp = { + disabled_plugins = { + "2html_plugin", + "tohtml", + "getscript", + "getscriptPlugin", + "gzip", + "logipat", + "netrw", + "netrwPlugin", + "netrwSettings", + "netrwFileHandlers", + "matchit", + "tar", + "tarPlugin", + "rrhelper", + "spellfile_plugin", + "vimball", + "vimballPlugin", + "zip", + "zipPlugin", + "tutor", + "rplugin", + "syntax", + "synmenu", + "optwin", + "compiler", + "bugreport", + "ftplugin", + }, + }, + }, +} diff --git a/env-available/server-ubuntu-24.04/nvchad_2025-04-27/lua/configs/lspconfig.lua b/env-available/server-ubuntu-24.04/nvchad_2025-04-27/lua/configs/lspconfig.lua new file mode 100644 index 0000000..bc79a49 --- /dev/null +++ b/env-available/server-ubuntu-24.04/nvchad_2025-04-27/lua/configs/lspconfig.lua @@ -0,0 +1,24 @@ +require("nvchad.configs.lspconfig").defaults() + +local servers = { "html", "cssls", "ts_ls", "rust_analyzer", "pyright" } +vim.lsp.enable(servers) + +local on_attach = require("nvchad.configs.lspconfig").on_attach +local on_init = require("nvchad.configs.lspconfig").on_init +local capabilities = require("nvchad.configs.lspconfig").capabilities +local lspconfig = require "lspconfig" + +for _, lsp in ipairs(servers) do + lspconfig[lsp].setup { + on_attach = on_attach, + on_init = on_init, + capabilities = capabilities, + } +end + +lspconfig.clangd.setup { + on_attach = on_attach, + on_init = on_init, + capabilities = capabilities, + filetypes = { "c", "cpp", "objc", "objcpp", "cuda", "lcp" }, +} diff --git a/env-available/server-ubuntu-24.04/nvchad_2025-04-27/lua/mappings.lua b/env-available/server-ubuntu-24.04/nvchad_2025-04-27/lua/mappings.lua new file mode 100644 index 0000000..783b78f --- /dev/null +++ b/env-available/server-ubuntu-24.04/nvchad_2025-04-27/lua/mappings.lua @@ -0,0 +1,10 @@ +require "nvchad.mappings" + +-- add yours here + +local map = vim.keymap.set + +map("n", ";", ":", { desc = "CMD enter command mode" }) +map("i", "jk", "") + +-- map({ "n", "i", "v" }, "", " w ") diff --git a/env-available/server-ubuntu-24.04/nvchad_2025-04-27/lua/options.lua b/env-available/server-ubuntu-24.04/nvchad_2025-04-27/lua/options.lua new file mode 100644 index 0000000..738f20b --- /dev/null +++ b/env-available/server-ubuntu-24.04/nvchad_2025-04-27/lua/options.lua @@ -0,0 +1,6 @@ +require "nvchad.options" + +-- add yours here! + +-- local o = vim.o +-- o.cursorlineopt ='both' -- to enable cursorline! diff --git a/env-available/server-ubuntu-24.04/nvchad_2025-04-27/lua/plugins/init.lua b/env-available/server-ubuntu-24.04/nvchad_2025-04-27/lua/plugins/init.lua new file mode 100644 index 0000000..1f6e8ab --- /dev/null +++ b/env-available/server-ubuntu-24.04/nvchad_2025-04-27/lua/plugins/init.lua @@ -0,0 +1,39 @@ +return { + { + "stevearc/conform.nvim", + -- event = 'BufWritePre', -- uncomment for format on save + opts = require "configs.conform", + }, + + -- These are some examples, uncomment them if you want to see them work! + { + "neovim/nvim-lspconfig", + config = function() + require "configs.lspconfig" + end, + }, + + { + "williamboman/mason.nvim", + opts = { + ensure_installed = { + "lua-language-server", "stylua", + "html-lsp", "css-lsp" , "prettier", + "clangd", "pyright", "rust-analyzer", + }, + }, + }, + + -- test new blink + -- { import = "nvchad.blink.lazyspec" }, + + -- { + -- "nvim-treesitter/nvim-treesitter", + -- opts = { + -- ensure_installed = { + -- "vim", "lua", "vimdoc", + -- "html", "css" + -- }, + -- }, + -- }, +} diff --git a/env-available/server-ubuntu-24.04/setup.sh b/env-available/server-ubuntu-24.04/setup.sh index 5870b68..b3b47cb 100755 --- a/env-available/server-ubuntu-24.04/setup.sh +++ b/env-available/server-ubuntu-24.04/setup.sh @@ -14,16 +14,16 @@ DEPS=( make cmake cmake-curses-gui libssl-dev pkg-config libtool-bin unzip gettext ripgrep exuberant-ctags - python3-dbg python3.12-venv + python3-dbg python3.12-venv python3-virtualenv openjdk-17-jre ansible memtester heaptrack sysstat iotop nvtop - # custom-neovim custom-nvchad + custom-rust # .bashrc requires Rust + custom-nvm # NOTE: nvim LSP clients require node; `nvm install node` required to install latest node and npm + custom-neovim custom-nvchad # custom-fzf - # custom-nvm - # custom-rust # nvidia-cuda-toolkit # custom-cudnn custom-nccl custom-cutensor custom-cusparselt # custom-just # https://just.systems/man/en/chapter_4.html -> cargo install just @@ -158,7 +158,7 @@ for pkg in "${DEPS[@]}"; do cd "$script_dir" git clone https://github.com/neovim/neovim cd neovim - git checkout v0.9.5 + git checkout v0.11.1 chown -R "$SUDO_USER:$SUDO_USER" "$script_dir/neovim" sudo -H -u "$SUDO_USER" bash -c "make CMAKE_BUILD_TYPE=Release -j4" make install @@ -168,12 +168,12 @@ for pkg in "${DEPS[@]}"; do if [ "$pkg" == custom-nvchad ]; then if [ ! -d "/home/$SUDO_USER/.config/nvim" ]; then - # sudo -H -u "$SUDO_USER" bash -c "git clone git@github.com:NvChad/starter.git '/home/$SUDO_USER/.config/nvim'" - # chown -R "$SUDO_USER:$SUDO_USER" "/home/$SUDO_USER/.config/nvim" - # cd "/home/$SUDO_USER/.config/nvim" - # git checkout v2.5 + sudo -H -u "$SUDO_USER" bash -c "git clone git@github.com:NvChad/starter.git $script_dir/nvchad_2025-04-27" + chown -R "$SUDO_USER:$SUDO_USER" "$script_dir/nvchad_2025-04-27" + cd $script_dir/nvchad_2025-04-27 + rm -rf .git if [ ! -L "/home/$SUDO_USER/.config/nvim" ]; then - ln -s "/home/$SUDO_USER/scripts/nvchad-v2.5" "/home/$SUDO_USER/.config/nvim" + ln -s "$script_dir/nvchad_2025-04-27" "/home/$SUDO_USER/.config/nvim" fi fi @@ -182,8 +182,9 @@ for pkg in "${DEPS[@]}"; do if [ "$pkg" == custom-nvm ]; then if [ ! -d "/home/$SUDO_USER/.nvm" ]; then - curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | sudo -H -u "$SUDO_USER" bash + curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | sudo -H -u "$SUDO_USER" bash fi + sudo -H -u "$SUDO_USER" bash -c "nvm install node" echo "$pkg is installed." && continue fi From 737cb746aaf8ad54d52852578289fd423317881c Mon Sep 17 00:00:00 2001 From: Marko Budiselic Date: Thu, 1 May 2025 09:46:07 +0000 Subject: [PATCH 3/3] Add docker installation --- env-available/server-ubuntu-24.04/.gitignore | 4 ++++ env-available/server-ubuntu-24.04/setup.sh | 21 +++++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 env-available/server-ubuntu-24.04/.gitignore diff --git a/env-available/server-ubuntu-24.04/.gitignore b/env-available/server-ubuntu-24.04/.gitignore new file mode 100644 index 0000000..95b7c8c --- /dev/null +++ b/env-available/server-ubuntu-24.04/.gitignore @@ -0,0 +1,4 @@ +neovim +nccl/ +*.zip +miniconda.sh diff --git a/env-available/server-ubuntu-24.04/setup.sh b/env-available/server-ubuntu-24.04/setup.sh index b3b47cb..6a10f96 100755 --- a/env-available/server-ubuntu-24.04/setup.sh +++ b/env-available/server-ubuntu-24.04/setup.sh @@ -23,6 +23,7 @@ DEPS=( custom-rust # .bashrc requires Rust custom-nvm # NOTE: nvim LSP clients require node; `nvm install node` required to install latest node and npm custom-neovim custom-nvchad + custom-docker # custom-fzf # nvidia-cuda-toolkit # custom-cudnn custom-nccl custom-cutensor custom-cusparselt @@ -183,8 +184,8 @@ for pkg in "${DEPS[@]}"; do if [ "$pkg" == custom-nvm ]; then if [ ! -d "/home/$SUDO_USER/.nvm" ]; then curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | sudo -H -u "$SUDO_USER" bash + sudo -H -u "$SUDO_USER" bash -c "source /home/$SUDO_USER/.bashrc && nvm install node" # TODO(gitbuda): This line still has an issue. fi - sudo -H -u "$SUDO_USER" bash -c "nvm install node" echo "$pkg is installed." && continue fi @@ -227,6 +228,24 @@ for pkg in "${DEPS[@]}"; do echo "$pkg is installed." && continue fi + if [ "$pkg" == custom-docker ]; then + if ! command -v docker > /dev/null 2>&1; then + sudo apt-get update -y + sudo apt-get install -y ca-certificates curl + sudo install -m 0755 -d /etc/apt/keyrings + sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc + sudo chmod a+r /etc/apt/keyrings/docker.asc + echo \ + "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \ + $(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}") stable" | \ + sudo tee /etc/apt/sources.list.d/docker.list > /dev/null + sudo apt-get update -y + sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin + sudo usermod -aG docker $SUDO_USER + fi + echo "$pkg is installed." && continue + fi + if [ "$pkg" == cargo-tree-sitter ]; then sudo -H -u "$SUDO_USER" bash -c "/home/$SUDO_USER/.cargo/bin/cargo install tree-sitter-cli" echo "$pkg is installed." && continue