From 19e3bc21a0f8baa7c81c10d239eb31773f48b65d Mon Sep 17 00:00:00 2001 From: 1ndev <1ndevelopment@protonmail.com> Date: Sat, 14 Dec 2024 09:02:06 -0800 Subject: [PATCH] Populate zshrc --- configure_system.sh | 82 ++++++++++++++ install_nix.sh | 2 +- zshrc | 260 +++++--------------------------------------- 3 files changed, 110 insertions(+), 234 deletions(-) create mode 100755 configure_system.sh diff --git a/configure_system.sh b/configure_system.sh new file mode 100755 index 0000000..51dd1d8 --- /dev/null +++ b/configure_system.sh @@ -0,0 +1,82 @@ +#!/usr/bin/env bash + +echo '' +echo "Disable read-only ? [y/n] (Enables System RW)" +read -q inputrw +if [[ $inputrw =~ ^[Yy]$ ]]; then + sudo steamos-readonly disable + sudo pacman-key --init + sudo pacman-key --populate holo + sudo pacman -Syu + sudo pacman -Sy archlinux-keyring +fi + + echo '' + echo "Enable verbose boot ? [y/n]" + read -q inputverbose + if [[ $inputverbose =~ ^[Yy]$ ]]; then + sudo awk '{gsub(/steamenv_quiet="loglevel=4 splash=verbose fbcon=nodefer"/, "steamenv_noisy=\"loglevel=4 splash=verbose fbcon=nodefer\"")} 1' /etc/grub.d/00_header > temp_file + sudo mv temp_file /etc/grub.d/00_header + sudo update-grub + fi + echo '' + echo "Install/Enable tailscale (VPN) ? [y/n]" + read -q inputvpn + if [[ $inputvpn =~ ^[Yy]$ ]]; then + git clone https://github.com/tailscale-dev/deck-tailscale + cd deck-tailscale + sudo bash tailscale.sh + source /etc/profile.d/tailscale.sh + sudo tailscale up --operator=deck --ssh + fi + echo '' + echo "Install/Enable no machine (NX) ? [y/n]" + read -q inputrx + if [[ $inputrx =~ ^[Yy]$ ]]; then + sudo steamos-readonly disable + sudo wget https://download.nomachine.com/download/8.14/Linux/nomachine_8.14.2_1_x86_64.tar.gz -P /usr + sudo tar -xvf /usr/nomachine_8.14.2_1_x86_64.tar.gz -C /usr/ + sudo /usr/NX/nxserver --install redhat + sudo rm -r /usr/nomachine_8.14.2_1_x86_64.tar.gz + fi + echo '' + echo "Install Android Tools (adb) ? [y/n]" + read -q inputadb + if [[ $inputadb =~ ^[Yy]$ ]]; then + sudo pacman -S --noconfirm android-tools + fi + echo '' + echo "Install Docker ? [y/n]" + read -q inputdocker + if [[ $inputdocker =~ ^[Yy]$ ]]; then + sudo pacman -S --noconfirm docker + systemctl start docker + fi + echo '' + echo "Install/Enable pip ? [y/n]" + read -q inputpip + if [[ $inputpip =~ ^[Yy]$ ]]; then + wget https://bootstrap.pypa.io/get-pip.py + python3 get-pip.py --user --break-system-packages + sudo rm get-pip.py + fi + echo '' + echo "Install JDK 21 ? [y/n]" + read -q inputjre + if [[ $inputjre =~ ^[Yy]$ ]]; then + sudo pacman -Syy + sudo pacman -Su + git clone https://github.com/BlackCorsair/install-jdk-on-steam-deck.git && \ + JDK_VERSION=21 ./install-jdk-on-steam-deck/scripts/install-jdk.sh && \ + sudo rm -r ./install-jdk-on-steam-deck + fi + echo '' + echo "Install yay ? [y/n]" + read -q inputyay + if [[ $inputjre =~ ^[Yy]$ ]]; then + git clone https://aur.archlinux.org/yay-bin.git + cd yay-bin + git checkout 96f90180a3cf72673b1769c23e2c74edb0293a9f + makepkg -si + fi + diff --git a/install_nix.sh b/install_nix.sh index c493f74..f274b84 100755 --- a/install_nix.sh +++ b/install_nix.sh @@ -73,4 +73,4 @@ sh <(curl -L https://nixos.org/nix/install) --daemon sudo echo "experimental-features = nix-command flakes" >> /etc/nix/nix.conf -echo "export XDG_DATA_DIRS="$HOME/.nix-profile/share:${XDG_DATA_DIRS:-/usr/local/share:/usr/share}" >> +# echo "export XDG_DATA_DIRS="$HOME/.nix-profile/share:${XDG_DATA_DIRS:-/usr/local/share:/usr/share}" >> diff --git a/zshrc b/zshrc index c507d0d..67f7d2d 100644 --- a/zshrc +++ b/zshrc @@ -1,217 +1,12 @@ -alias cls='clear' -alias x='exit' - - -alias nixins='nix-env -iA nixpkgs.$1' -alias nixsearch='nix search nixpkgs $1' - -alias fpl='flatpak list' - -alias lstin='sudo pacman -Qe' -alias lst='sudo pacman -Q' -alias inspkg='sudo dpkg -i ' -# alias upd='sudo pacman -S' -alias upg='sudo apt upgrade -y' -alias ins='sudo pacman -S ' -alias uni='sudo pacman -R' -alias cln='sudo apt autoremove -y' -alias fix='sudo apt --fix-broken install -y' - -alias n='nano' -alias browser='lynx https://search.1ndev.com/' -alias biggest='du . -ha | sort -hr | head -n $1' - -export WORK_WEEK=$(date "+%yww%W.%u") -export LAN_IP=$(ip -json route get 8.8.8.8 | jq -r '.[].prefsrc') -export TAILSCALE_IP=$(tailscale status | awk '{print $1}' | awk 'NR == 1 {print}') - -echo "Configure System? [y/n]" -read -q inputconfigsys -if [[ $inputconfigsys =~ ^[Yy]$ ]]; then - echo '' - echo "Disable read-only ? [y/n] (sudo access)" - read -q inputrw - if [[ $inputrw =~ ^[Yy]$ ]]; then - sudo steamos-readonly disable - sudo pacman-key --init - sudo pacman-key --populate holo - sudo pacman -Syu - sudo pacman -Sy archlinux-keyring - fi - echo '' - echo "Update packages via pacman? [y/n]" - read -q inputupdatepackages - if [[ $inputupdatepackages =~ ^[Yy]$ ]]; then - sudo pacman -Syyu - fi - echo '' - echo "Install nix? [y/n]" - read -q inputnix - if [[ $inputnix =~ ^[Yy]$ ]]; then - echo '' - fi - echo '' - echo "Enable verbose boot ? [y/n]" - read -q inputverbose - if [[ $inputverbose =~ ^[Yy]$ ]]; then - sudo awk '{gsub(/steamenv_quiet="loglevel=4 splash=verbose fbcon=nodefer"/, "steamenv_noisy=\"loglevel=4 splash=verbose fbcon=nodefer\"")} 1' /etc/grub.d/00_header > temp_file - sudo mv temp_file /etc/grub.d/00_header - sudo update-grub - fi - echo '' - echo "Install/Enable tailscale (VPN) ? [y/n]" - read -q inputvpn - if [[ $inputvpn =~ ^[Yy]$ ]]; then - git clone https://github.com/tailscale-dev/deck-tailscale - cd deck-tailscale - sudo bash tailscale.sh - source /etc/profile.d/tailscale.sh - sudo tailscale up --operator=deck --ssh - fi - echo '' - echo "Install/Enable no machine (NX) ? [y/n]" - read -q inputrx - if [[ $inputrx =~ ^[Yy]$ ]]; then - sudo steamos-readonly disable - sudo wget https://download.nomachine.com/download/8.14/Linux/nomachine_8.14.2_1_x86_64.tar.gz -P /usr - sudo tar -xvf /usr/nomachine_8.14.2_1_x86_64.tar.gz -C /usr/ - sudo /usr/NX/nxserver --install redhat - sudo rm -r /usr/nomachine_8.14.2_1_x86_64.tar.gz - fi - echo '' - echo "Install Android Tools (adb) ? [y/n]" - read -q inputadb - if [[ $inputadb =~ ^[Yy]$ ]]; then - sudo pacman -S --noconfirm android-tools - fi - echo '' - echo "Install Docker ? [y/n]" - read -q inputdocker - if [[ $inputdocker =~ ^[Yy]$ ]]; then - sudo pacman -S --noconfirm docker - systemctl start docker - fi - echo '' - echo "Install/Enable pip ? [y/n]" - read -q inputpip - if [[ $inputpip =~ ^[Yy]$ ]]; then - wget https://bootstrap.pypa.io/get-pip.py - python3 get-pip.py --user --break-system-packages - sudo rm get-pip.py - fi - echo '' - echo "Install JDK 21 ? [y/n]" - read -q inputjre - if [[ $inputjre =~ ^[Yy]$ ]]; then - sudo pacman -Syy - sudo pacman -Su - git clone https://github.com/BlackCorsair/install-jdk-on-steam-deck.git && \ - JDK_VERSION=21 ./install-jdk-on-steam-deck/scripts/install-jdk.sh && \ - sudo rm -r ./install-jdk-on-steam-deck - fi - echo '' - echo "Install yay ? [y/n]" - read -q inputyay - if [[ $inputjre =~ ^[Yy]$ ]]; then - git clone https://aur.archlinux.org/yay-bin.git - cd yay-bin - git checkout 96f90180a3cf72673b1769c23e2c74edb0293a9f - makepkg -si - fi -fi - -echo "$WORK_WEEK" -echo '' -date -echo '' -cal -echo "TAILSCALE IP: $TAILSCALE_IP" -echo "LAN IP: $LAN_IP" -echo "WAN IP: $WAN_IP" -echo '' -$HOME/.local/bin/fastfetch --logo-preserve-aspect-ratio true --logo-type none -echo '' - -# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc. # Initialization code that may require console input (password prompts, [y/n] # confirmations, etc.) must go above this block; everything else may go below. if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" fi +export PATH="$HOME/.local/bin:$HOME/.local/jdk:/opt/tailscale:$PATH" ZSH="$HOME/.oh-my-zsh" -# If you come from bash you might have to change your $PATH. -# export PATH=$HOME/bin:/usr/local/bin:$PATH -export PATH="$HOME/.local/bin:$HOME/.local/jdk:/opt/tailscale:$PATH" - -# Path to your oh-my-zsh installation. -export ZSH="$HOME/.oh-my-zsh" - -# Set name of the theme to load --- if set to "random", it will -# load a random theme each time oh-my-zsh is loaded, in which case, -# to know which specific one was loaded, run: echo $RANDOM_THEME -# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes ZSH_THEME="powerlevel10k/powerlevel10k" -# Set list of themes to pick from when loading at random -# Setting this variable when ZSH_THEME=random will cause zsh to load -# a theme from this variable instead of looking in $ZSH/themes/ -# If set to an empty array, this variable will have no effect. -# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" ) - -# Uncomment the following line to use case-sensitive completion. -# CASE_SENSITIVE="true" - -# Uncomment the following line to use hyphen-insensitive completion. -# Case-sensitive completion must be off. _ and - will be interchangeable. -# HYPHEN_INSENSITIVE="true" - -# Uncomment one of the following lines to change the auto-update behavior -# zstyle ':omz:update' mode disabled # disable automatic updates -# zstyle ':omz:update' mode auto # update automatically without asking -# zstyle ':omz:update' mode reminder # just remind me to update when it's time - -# Uncomment the following line to change how often to auto-update (in days). -# zstyle ':omz:update' frequency 13 - -# Uncomment the following line if pasting URLs and other text is messed up. -# DISABLE_MAGIC_FUNCTIONS="true" - -# Uncomment the following line to disable colors in ls. -# DISABLE_LS_COLORS="true" - -# Uncomment the following line to disable auto-setting terminal title. -# DISABLE_AUTO_TITLE="true" - -# Uncomment the following line to enable command auto-correction. -# ENABLE_CORRECTION="true" - -# Uncomment the following line to display red dots whilst waiting for completion. -# You can also set it to another string to have that shown instead of the default red dots. -# e.g. COMPLETION_WAITING_DOTS="%F{yellow}waiting...%f" -# Caution: this setting can cause issues with multiline prompts in zsh < 5.7.1 (see #5765) -# COMPLETION_WAITING_DOTS="true" - -# Uncomment the following line if you want to disable marking untracked files -# under VCS as dirty. This makes repository status check for large repositories -# much, much faster. -# DISABLE_UNTRACKED_FILES_DIRTY="true" - -# Uncomment the following line if you want to change the command execution time -# stamp shown in the history command output. -# You can set one of the optional three formats: -# "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd" -# or set a custom format using the strftime function format specifications, -# see 'man strftime' for details. -# HIST_STAMPS="mm/dd/yyyy" - -# Would you like to use another custom folder than $ZSH/custom? -# ZSH_CUSTOM=/path/to/new-custom-folder - -# Which plugins would you like to load? -# Standard plugins can be found in $ZSH/plugins/ -# Custom plugins may be added to $ZSH_CUSTOM/plugins/ -# Example format: plugins=(rails git textmate ruby lighthouse) -# Add wisely, as too many plugins slow down shell startup. plugins=( git zsh-autosuggestions @@ -219,36 +14,35 @@ plugins=( source $ZSH/oh-my-zsh.sh -# User configuration +[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh -# export MANPATH="/usr/local/man:$MANPATH" +## User Config -# You may need to manually set your language environment -# export LANG=en_US.UTF-8 +export WORK_WEEK=$(date "+%yww%W.%u") +export LAN_IP=$(ip -json route get 8.8.8.8 | jq -r '.[].prefsrc') +# export TAILSCALE_IP=$(tailscale status | awk '{print $1}' | awk 'NR == 1 {print}') -# Preferred editor for local and remote sessions -# if [[ -n $SSH_CONNECTION ]]; then -# export EDITOR='vim' -# else -# export EDITOR='mvim' -# fi - -# Compilation flags -# export ARCHFLAGS="-arch x86_64" - -# Set personal aliases, overriding those provided by oh-my-zsh libs, -# plugins, and themes. Aliases can be placed here, though oh-my-zsh -# users are encouraged to define aliases within the ZSH_CUSTOM folder. -# For a full list of active aliases, run `alias`. -# -# Example aliases -# alias zshconfig="mate ~/.zshrc" -# alias ohmyzsh="mate ~/.oh-my-zsh" -alias ls="lsd" +alias ls='lsd' +alias dir='ls -1a' +alias cls='clear' +alias x='exit' +alias n='nano' +alias biggest='du . -ha | sort -hr | head -n $1' alias ifconfig="ip add" + +alias nixins='nix-env -iA nixpkgs.$1' +alias nixfind='nix search nixpkgs $1' + +alias fpl='flatpak list' + +alias pmins='sudo pacman -S' +alias pmuni='sudo pacman -R' +alias pmupd='sudo pacman -Sy' +alias pmupg='sudo pacman -Syyu' +alias pmlst='sudo pacman -Q' +alias pmlstin='sudo pacman -Qe' + +alias browser='lynx https://search.1ndev.com/' alias androidscreen="scrcpy -w" -source ~/.oh-my-zsh/powerlevel10k/powerlevel10k.zsh-theme - -# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh. -[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh +## End of User Config