Compare commits

...

7 Commits

Author SHA1 Message Date
0456dba5d1 (feat) Update dotfile scripts & tooling
- Update & split scripts
- Main package install script
- Fish / environment install script
- Dockerfile for testing locally
2023-10-31 17:19:40 +01:00
66fbc7eeab Merge pull request 'Make FiSH >3.3 compatible + Update AWS SSM remote port forwarding config' (#4) from bugfix/make-fish-3-3-compatible into master
Reviewed-on: #4
2022-06-06 17:12:45 +02:00
a1186a2c1c feat: update ssm tunneling script 2022-06-05 10:26:10 +02:00
2ed69bc664 Merge pull request 'bugfix/make-fish-3-3-compatible' (#3)
Reviewed-on: #3
2022-04-30 11:45:17 +02:00
36ec3bb485 (bugfix) make compatible with fish version >=3.3
- cleanup
- minor comments and fixes
2022-04-30 11:31:57 +02:00
8720d0e19b chore: fix nested git repos 2022-02-18 14:12:52 +01:00
e4939853d6 bugfix: make fish 3.3. compatible 2022-02-17 10:07:30 +01:00
19 changed files with 361 additions and 222 deletions

4
.dockerignore Normal file
View File

@ -0,0 +1,4 @@
.vscode
workspace.code-workspace
.git
.venv

2
.gitignore vendored
View File

@ -1,2 +1,2 @@
.vscode .vscode
twaiceAWS.fish workspace.code-workspace

64
1_main_setup.sh Executable file
View File

@ -0,0 +1,64 @@
#!/bin/bash
set -e
# run as root/sudo
if [ "$EUID" -ne 0 ]
then echo "Please run as root / sudo"
exit
fi
DOCKER_COMPOSE_VERSION=v2.23.0
# Update sources
apt-get update
#tzdata region settings
TZ_REGION=Europe
TZ_ZONE=Berlin
# make tzdata noninteractive on docker...
echo "tzdata tzdata/Areas select $TZ_REGION" | debconf-set-selections
echo "tzdata tzdata/Zones/$TZ_REGION select $TZ_ZONE" | debconf-set-selections
DEBIAN_FRONTEND="noninteractive" apt install tzdata -y
# Upgrade System:
apt-get upgrade -y
# install env packages
apt-get install git fish build-essential jq vim curl sudo unzip fzf htop -y
# pyenv dependencies
apt-get install python3-dev python3-setuptools python3-pip python3-venv python3-smbus pipx liblzma-dev libffi-dev libssl-dev openssl zlib1g-dev libsqlite3-dev tk-dev libreadline-dev libbz2-dev -y
# install docker stable, if this failes try below
curl -fsSLo- https://get.docker.com | sh
#curl -fsSLo- https://test.docker.com | sh
# install docker-compose
curl -L https://github.com/docker/compose/releases/download/$DOCKER_COMPOSE_VERSION/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
# aws cli
cd /tmp
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
./aws/install
rm awscliv2.zip
rm -rf ./aws
# session manager plugin
curl "https://s3.amazonaws.com/session-manager-downloads/plugin/latest/ubuntu_64bit/session-manager-plugin.deb" -o "session-manager-plugin.deb"
dpkg -i session-manager-plugin.deb
cd -
read -p "User that will be used after installation complete: " NEW_USER
passwd $NEW_USER
# give user docker permissions
usermod -aG docker $NEW_USER
echo "######################################"
echo "# Changing default shell to fish now #"
echo "# Please call ./2_fish_setup.sh #"
echo "######################################"
chsh $NEW_USER -s /usr/bin/fish
sudo -i -u $NEW_USER fish

72
2_fish_setup.sh Executable file
View File

@ -0,0 +1,72 @@
#!/bin/fish
set PYTHON_VERSION 3.11.6
set NODE_VERSION lts/hydrogen
# dont run as root/sudo
if [ "$EUID" -eq 0 ]
then echo "Please do not run as root / sudo"
exit 1
end
# install rust toolchain
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# install pyenv
git clone https://github.com/pyenv/pyenv.git $HOME/.pyenv
# install nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash
# install fzf from source
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
bash ~/.fzf/install --no-update-rc --completion --key-bindings
# install fisher
curl -sL https://raw.githubusercontent.com/jorgebucaran/fisher/main/functions/fisher.fish | source && fisher install jorgebucaran/fisher
# copy fish config
if test -f "~/.config/fish/functions/config.fish"; then
echo "config.fish already exist, please rename to continue."
exit 1
end
cp fish/config.fish ~/.config/fish/
# copy fishfile
if test -f "~/.config/fish/fish_plugins"; then
echo "fish_plugins already exist, please rename to continue."
exit 1
end
cp fish/fish_plugins ~/.config/fish/
# setup pyenv, cargo + local bin paths in fish
mkdir $HOME/.local/bin
set -Ux PYENV_ROOT $HOME/.pyenv
fish_add_path $PYENV_ROOT/bin
fish_add_path $HOME/.local/bin
fish_add_path $HOME/.cargo/bin
# install packages from fishfile
fisher update
cp -R fish/theme-t31m/functions/* ~/.config/fish/functions/
# install node via nvm
nvm install $NODE_VERSION
nvm alias default $NODE_VERSION
# Install Python
pyenv install $PYTHON_VERSION
# pip install --upgrade pip
# Install pipx for future non-user local packages
pipx ensurepath
# pipx completions
pipx completions
register-python-argcomplete --shell fish pipx >~/.config/fish/completions/pipx.fish
# cp vimrc
echo "Installing .vimrc"
cp dot.vimrc $HOME/.vimrc

18
Dockerfile Normal file
View File

@ -0,0 +1,18 @@
FROM ubuntu:mantic
ARG USER=testuser
RUN apt-get update && apt-get upgrade -y && \
apt-get install git fish build-essential jq vim curl sudo unzip fzf htop \
python3-dev python3-setuptools python3-pip python3-venv python3-smbus pipx liblzma-dev libffi-dev \
libssl-dev openssl zlib1g-dev libsqlite3-dev tk-dev libreadline-dev libbz2-dev locales -y \
&& rm -rf /var/lib/apt/lists/* && localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
ENV LANG en_US.utf8
RUN useradd -m -s /usr/bin/bash $USER
RUN usermod -aG sudo $USER
WORKDIR /app
ENTRYPOINT [ "/bin/bash" ]

View File

@ -11,6 +11,13 @@ T31M Dotfiles Repository
### Contents ### ### Contents ###
* FiSH Shell Setup & Configuration * FiSH Shell Setup & Configuration
* Theme/Prompt Based heavily on: omf/theme-sushi check it out * Theme/Prompt Based heavily on: omf/theme-sushi check it out
* NVM + NVM FiSH support * NVM + Pyenv / PipX / AWS FiSH support
* edc/bass * edc/bass
* fzf * fzf
### Test in Docker
There are some runtime issues due to mounting of .git folder when executing container for test installation !
* `docker build --build-arg USER=*your user* -t fish-test .`
* `docker run --rm -it -v (pwd):/app --mount type=volume,dst=/app/.git --name fish-test fish-test`

View File

@ -1,7 +1,8 @@
set -Ux PYENV_ROOT $HOME/.pyenv if status is-interactive
set -Ux fish_user_paths $PYENV_ROOT/bin $fish_user_paths # Commands to run in interactive sessions can go here
# pyenv init # pyenv init
if command -v pyenv 1>/dev/null 2>&1 if command -v pyenv 1>/dev/null 2>&1
pyenv init - | source pyenv init - | source
end
end end

View File

@ -1,4 +1,3 @@
jorgebucaran/fisher
edc/bass edc/bass
jethrokuan/fzf jethrokuan/fzf
FabioAntunes/fish-nvm FabioAntunes/fish-nvm

View File

@ -1,3 +1,4 @@
function cdk -d "execute aws cdk" -w cdk # Defined in - @ line 1
__nvm_run "cdk" $argv function cdk --wraps='npx aws-cdk@1.x' --description 'alias cdk=npx aws-cdk@1.x'
npx aws-cdk@1.x $argv;
end end

View File

@ -0,0 +1,4 @@
# Defined in - @ line 1
function cdk --wraps='npx aws-cdk@2.x' --description 'alias cdk=npx aws-cdk@2.x'
npx aws-cdk@2.x $argv;
end

View File

@ -4,6 +4,7 @@
set AWS_IAM_USER "" set AWS_IAM_USER ""
# TODO setup your aws-mfa credential keys in the credentials file # TODO setup your aws-mfa credential keys in the credentials file
# TODO replace "PLACE_YOUR_ROLE_HERE" with the actual role you want to assume.
# AWS Account details # AWS Account details
set DEV_ACCOUNT_ID "" set DEV_ACCOUNT_ID ""
@ -11,6 +12,7 @@ set STG_ACCOUNT_ID ""
set PROD_ACCOUNT_ID "" set PROD_ACCOUNT_ID ""
set OPS_ACCOUNT_ID "" set OPS_ACCOUNT_ID ""
# Update if different regions are used in your setup
export AWS_REGION=eu-west-1 export AWS_REGION=eu-west-1
export AWS_DEFAULT_REGION=eu-west-1 export AWS_DEFAULT_REGION=eu-west-1
@ -24,19 +26,19 @@ function envAWS --description 'switch to different aws account environments (-)
switch $argv[1] switch $argv[1]
case dev case dev
echo "switching to /refreshing dev" echo "switching to /refreshing dev"
aws-mfa --assume-role arn:aws:iam::$DEV_ACCOUNT_ID:role/Administrator --duration 43200 --role-session-name $AWS_IAM_USER aws-mfa --assume-role arn:aws:iam::$DEV_ACCOUNT_ID:role/PLACE_YOUR_ROLE_HERE --duration 43200 --role-session-name "$AWS_IAM_USER"
getAWSenv getAWSenv
case stg case stg
echo "switching to /refreshing staging" echo "switching to /refreshing staging"
aws-mfa --assume-role arn:aws:iam::$STG_ACCOUNT_ID:role/Administrator --duration 43200 --role-session-name $AWS_IAM_USER aws-mfa --assume-role arn:aws:iam::$STG_ACCOUNT_ID:role/PLACE_YOUR_ROLE_HERE --duration 43200 --role-session-name "$AWS_IAM_USER"
getAWSenv getAWSenv
case prod case prod
echo "switching to /refreshing prod" echo "switching to /refreshing prod"
aws-mfa --assume-role arn:aws:iam::$PROD_ACCOUNT_ID:role/Administrator --duration 3600 --role-session-name $AWS_IAM_USER aws-mfa --assume-role arn:aws:iam::$PROD_ACCOUNT_ID:role/PLACE_YOUR_ROLE_HERE --duration 3600 --role-session-name "$AWS_IAM_USER"
getAWSenv getAWSenv
case ops case ops
echo "switching to /refreshing ops" echo "switching to /refreshing ops"
aws-mfa --assume-role arn:aws:iam::$OPS_ACCOUNT_ID:role/Administrator --duration 3600 --role-session-name $AWS_IAM_USER aws-mfa --assume-role arn:aws:iam::$OPS_ACCOUNT_ID:role/PLACE_YOUR_ROLE_HERE --duration 3600 --role-session-name "$AWS_IAM_USER"
getAWSenv getAWSenv
case '*' case '*'
echo "Wrong / Invalid Environment provided" echo "Wrong / Invalid Environment provided"
@ -65,3 +67,12 @@ function getAWSenv --description 'verify and set environment'
return 1 return 1
end end
end end
function getSecretAWS --description 'get & decrypt secrets from ssm parameter store via cli command if permissions are granted'
if test (count $argv) -lt 1
echo "Provide a Path to the Secret"
return
end
aws ssm get-parameter --name "$argv[1]" --with-decryption | jq .Parameter.Value -r
end

View File

@ -0,0 +1,12 @@
# Place this in your Fish functions folder to make it available immediately
# e.g. ~/.config/fish/functions/envsource.fish
#
# Usage: envsource <path/to/env>
function envsource
for line in (cat $argv | grep -v '^#')
set item (string split -m 1 '=' $line)
set -gx $item[1] $item[2]
echo "Exported key $item[1]"
end
end

View File

@ -1,9 +1,97 @@
# Colors
function orange
set_color -o ee5819
end
function yellow
set_color -o b58900
end
function red
set_color -o d30102
end
function cyan
set_color -o 2aa198
end
function white
set_color -o fdf6e3
end
function dim
set_color -o 4f4f4f
end
function off
set_color -o normal
end
# Git
function git::is_repo
test -d .git; or command git rev-parse --git-dir >/dev/null 2>/dev/null
end
function git::ahead -a ahead behind diverged none
not git::is_repo; and return
set -l commit_count (command git rev-list --count --left-right "@{upstream}...HEAD" 2>/dev/null)
switch "$commit_count"
case ""
# no upstream
case "0"\t"0"
test -n "$none"; and echo "$none"; or echo ""
case "*"\t"0"
test -n "$behind"; and echo "$behind"; or echo "-"
case "0"\t"*"
test -n "$ahead"; and echo "$ahead"; or echo "+"
case "*"
test -n "$diverged"; and echo "$diverged"; or echo "±"
end
end
function git::branch_name
git::is_repo; and begin
command git symbolic-ref --short HEAD 2>/dev/null;
or command git show-ref --head -s --abbrev | head -n1 2>/dev/null
end
end
function git::is_dirty
git::is_repo; and not command git diff --no-ext-diff --quiet --exit-code
end
function git::is_staged
git::is_repo; and begin
not command git diff --cached --no-ext-diff --quiet --exit-code
end
end
function git::is_stashed
git::is_repo; and begin
command git rev-parse --verify --quiet refs/stash >/dev/null
end
end
function git::is_touched
git::is_repo; and begin
test -n (echo (command git status --porcelain))
end
end
function git::untracked
git::is_repo; and begin
command git ls-files --other --exclude-standard
end
end
function fish_prompt function fish_prompt
set -l symbol "λ " set -l symbol "λ "
set -l code $status set -l code $status
set t31m_custom_right (t31m_prompt_right) set t31m_custom_left (t31m_prompt_left)
echo -ns "$t31m_custom_right" echo -ns "$t31m_custom_left"
if test -n "$ssh_client" if test -n "$ssh_client"
set -l host (hostname -s) set -l host (hostname -s)
@ -12,7 +100,7 @@ function fish_prompt
end end
if git::is_repo if git::is_repo
set -l branch (git::branch_name ^/dev/null) set -l branch (git::branch_name 2>/dev/null)
set -l ref (git show-ref --head --abbrev | awk '{print substr($0,0,7)}' | sed -n 1p) set -l ref (git show-ref --head --abbrev | awk '{print substr($0,0,7)}' | sed -n 1p)
printf '%s ' \U1F6E0 printf '%s ' \U1F6E0
@ -26,7 +114,7 @@ function fish_prompt
printf (white)"*"(off) printf (white)"*"(off)
end end
if command git symbolic-ref HEAD > /dev/null ^/dev/null if command git symbolic-ref HEAD > /dev/null 2>/dev/null
if git::is_staged if git::is_staged
printf (cyan)"$branch"(off) printf (cyan)"$branch"(off)
else else
@ -37,8 +125,8 @@ function fish_prompt
end end
for remote in (git remote) for remote in (git remote)
set -l behind_count (echo (command git rev-list $branch..$remote/$branch ^/dev/null | wc -l | tr -d " ")) set -l behind_count (echo (command git rev-list $branch..$remote/$branch 2>/dev/null | wc -l | tr -d " "))
set -l ahead_count (echo (command git rev-list $remote/$branch..$branch ^/dev/null | wc -l | tr -d " ")) set -l ahead_count (echo (command git rev-list $remote/$branch..$branch 2>/dev/null | wc -l | tr -d " "))
if test $ahead_count -ne 0; or test $behind_count -ne 0; and test (git remote | wc -l) -gt 1 if test $ahead_count -ne 0; or test $behind_count -ne 0; and test (git remote | wc -l) -gt 1
echo -n -s " "(orange)$remote(off) echo -n -s " "(orange)$remote(off)

View File

@ -1,107 +0,0 @@
# Colors
function orange
set_color -o ee5819
end
function yellow
set_color -o b58900
end
function red
set_color -o d30102
end
function cyan
set_color -o 2aa198
end
function white
set_color -o fdf6e3
end
function dim
set_color -o 4f4f4f
end
function off
set_color -o normal
end
# Git
function git::is_repo
test -d .git; or command git rev-parse --git-dir >/dev/null ^/dev/null
end
function git::ahead -a ahead behind diverged none
not git::is_repo; and return
set -l commit_count (command git rev-list --count --left-right "@{upstream}...HEAD" ^/dev/null)
switch "$commit_count"
case ""
# no upstream
case "0"\t"0"
test -n "$none"; and echo "$none"; or echo ""
case "*"\t"0"
test -n "$behind"; and echo "$behind"; or echo "-"
case "0"\t"*"
test -n "$ahead"; and echo "$ahead"; or echo "+"
case "*"
test -n "$diverged"; and echo "$diverged"; or echo "±"
end
end
function git::branch_name
git::is_repo; and begin
command git symbolic-ref --short HEAD ^/dev/null;
or command git show-ref --head -s --abbrev | head -n1 ^/dev/null
end
end
function git::is_dirty
git::is_repo; and not command git diff --no-ext-diff --quiet --exit-code
end
function git::is_staged
git::is_repo; and begin
not command git diff --cached --no-ext-diff --quiet --exit-code
end
end
function git::is_stashed
git::is_repo; and begin
command git rev-parse --verify --quiet refs/stash >/dev/null
end
end
function git::is_touched
git::is_repo; and begin
test -n (echo (command git status --porcelain))
end
end
function git::untracked
git::is_repo; and begin
command git ls-files --other --exclude-standard
end
end
function fish_right_prompt
if test "$theme_complete_path" = "yes"
set cwd (prompt_pwd)
else
set cwd (basename (prompt_pwd))
if git::is_repo
set root_folder (command git rev-parse --show-toplevel ^/dev/null)
set parent_root_folder (dirname $root_folder)
set cwd (echo $PWD | sed -e "s|$parent_root_folder/||")
end
end
# Because of having a two line promt now we dont need right anymore so we dont print anything here atm
#printf (yellow)"("(off)$cwd(yellow)") "(off)
#printf (off)(date +%H(yellow):(off)%M(yellow):(off)%S)(off)"\n"
end

View File

@ -1,38 +1,74 @@
function ssm_tunnel --description 'access private AWS ressources via Bastion Host' # See: https://aws.amazon.com/about-aws/whats-new/2022/05/aws-systems-manager-support-port-forwarding-remote-hosts-using-session-manager/
# And: https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager-working-with-sessions-start.html#sessions-remote-port-forwarding
function ssm_tunnel --description 'Access private AWS ressources via native SSM port forwarding through bastion'
if test (count $argv) -lt 2 if test (count $argv) -lt 2
echo "Provide an Host:Port Mapping & an Local Port" echo "Provide an Host:Port Mapping & an Local Port"
return return
end end
if [ "$env" != "ops" ]
echo "Switch to OPS ENV first"
return
end
# Get bastion host ID using it's name # Get bastion host ID using it's name
set INSTANCE_ID (aws ec2 describe-instances \ set INSTANCE_ID (aws ec2 describe-instances \
--filter 'Name=tag:Name,Values=ops-infrastructure-bastion'\ --filter 'Name=tag:Name,Values=INSTANCE_NAME_HERE'\
--query "Reservations[].Instances[?State.Name == 'running'].InstanceId[]"\ --query "Reservations[].Instances[?State.Name == 'running'].InstanceId[]"\
--output text) --output text)
# AWS Remote host i.e elastic.aws.com:80 # AWS Remote host i.e AWS Remote host i.e internal.x.yourdns / xxx.eu-west-1.elb.amazonaws.com
set REMOTE_HOST $argv[1] set REMOTE_HOST (string split -f1 : $argv[1])
set REMOTE_PORT (string split -f2 : $argv[1])
# Ports to bind for forwarding # Local port to bind for forwarding
set LOCAL_PORT $argv[2] set LOCAL_PORT $argv[2]
set REM_PORT (math (random) % 65535 + 2000)
set TIMEOUT 21600 #seconds until forwarding session times out (48h max)
# make sure jq is installed # Seconds until forwarding session times out (6h max)
# Start socat on the remote server set TIMEOUT 21600
set CMD "'sudo socat TCP4-LISTEN:$REM_PORT,reuseaddr,fork TCP4:$REMOTE_HOST'"
set CMD_INVOC_ID (aws ssm send-command --instance-ids $INSTANCE_ID \
--document-name 'AWS-RunShellScript' \
--parameters "commands=$CMD,executionTimeout=$TIMEOUT" --output json | jq -r '.Command.CommandId')
# Start tunnel session # Start tunnel session
echo "Starting Tunnel" echo "Starting Tunnel"
aws ssm start-session --target $INSTANCE_ID \ aws ssm start-session --target $INSTANCE_ID \
--document-name "AWS-StartPortForwardingSession" \ --document-name "AWS-StartPortForwardingSessionToRemoteHost" \
--parameters "portNumber=$REM_PORT,localPortNumber=$LOCAL_PORT" --parameters "host=[$REMOTE_HOST],portNumber=[$REMOTE_PORT],localPortNumber=[$LOCAL_PORT]"
# stop socat on the bastion echo "Tunneling Session Exited."
aws ssm cancel-command --command-id $CMD_INVOC_ID
echo "Command Cancelled Successfully."
end end
# This function is for custom & higher privileged users only.
function ssm_tunnel_admin --description 'Access private AWS ressources via native SSM port forwarding through bastion'
if test (count $argv) -lt 2
echo "Provide an Host:Port Mapping & an Local Port"
return
end
if [ "$env" != "ops" ]
echo "Switch to OPS ENV first"
return
end
# Get bastion host ID using it's name
set INSTANCE_ID (aws ec2 describe-instances \
--filter 'Name=tag:Name,Values=INSTANCE_NAME_HERE'\
--query "Reservations[].Instances[?State.Name == 'running'].InstanceId[]"\
--output text)
# AWS Remote host i.e internal.x.yourdns / xxx.eu-west-1.elb.amazonaws.com
set REMOTE_HOST (string split -f1 : $argv[1])
set REMOTE_PORT (string split -f2 : $argv[1])
# Local port to bind for forwarding
set LOCAL_PORT $argv[2]
# Seconds until forwarding session times out (6h max)
set TIMEOUT 21600
# Start tunnel session
echo "Starting Tunnel"
aws ssm start-session --target $INSTANCE_ID \
--document-name "AWS-StartPortForwardingSessionToRemoteHost" \
--parameters "host=[$REMOTE_HOST],portNumber=[$REMOTE_PORT],localPortNumber=[$LOCAL_PORT]"
echo "Tunneling Session Exited."
end

View File

@ -22,7 +22,6 @@ function prompt::pyenv
set venv (echo "$VIRTUAL_ENV" | grep -Eo '[^/]+/?$' | cut -d / -f1) set venv (echo "$VIRTUAL_ENV" | grep -Eo '[^/]+/?$' | cut -d / -f1)
echo -n -s (printf '%s' \U1F40D)(yellow)"["(cyan)"$venv"(yellow)"@"(off)"$python_version"(yellow)"]"(off) echo -n -s (printf '%s' \U1F40D)(yellow)"["(cyan)"$venv"(yellow)"@"(off)"$python_version"(yellow)"]"(off)
else if test -n "$PYENV_VERSION"; and [ "$PYENV_VERSION" != "$python_version" ] else if test -n "$PYENV_VERSION"; and [ "$PYENV_VERSION" != "$python_version" ]
# echo -n -s (yellow)(printf '%s' \U1F40D)"["(cyan)(pyenv version-name | sed 's/:.*$//' )(off)"@$python_version"(yellow)"]"(off)
echo -n -s (yellow)(printf '%s' \U1F40D)"["(cyan)(pyenv version-name )(off)"@$python_version"(yellow)"]"(off) echo -n -s (yellow)(printf '%s' \U1F40D)"["(cyan)(pyenv version-name )(off)"@$python_version"(yellow)"]"(off)
else if test -n "$python_version" else if test -n "$python_version"
echo -n -s (yellow)(printf '%s' \U1F40D)"["(off)$python_version(yellow)"]"(off) echo -n -s (yellow)(printf '%s' \U1F40D)"["(off)$python_version(yellow)"]"(off)

View File

@ -1,5 +1,5 @@
# moved original theme right prompt to left as we are working with a new line promt now. # moved original theme right prompt to left
function t31m_prompt_right function t31m_prompt_left
if test "$theme_complete_path" = "yes" if test "$theme_complete_path" = "yes"
set cwd (prompt_pwd) set cwd (prompt_pwd)
@ -7,7 +7,7 @@ function t31m_prompt_right
set cwd (basename (prompt_pwd)) set cwd (basename (prompt_pwd))
if git::is_repo if git::is_repo
set root_folder (command git rev-parse --show-toplevel ^/dev/null) set root_folder (command git rev-parse --show-toplevel 2> /dev/null)
set parent_root_folder (dirname $root_folder) set parent_root_folder (dirname $root_folder)
set cwd (echo $PWD | sed -e "s|$parent_root_folder/||") set cwd (echo $PWD | sed -e "s|$parent_root_folder/||")
end end

View File

@ -1,46 +0,0 @@
#!/bin/bash
set -x
# install nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash
# install pyenv
git clone https://github.com/pyenv/pyenv.git ~/.pyenv
# install fzf from source
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
bash ~/.fzf/install --no-update-rc --completion --key-bindings
# install fisher
curl -sL https://git.io/fisher | source && fisher install jorgebucaran/fisher $plugins
# copy fish config
if test -f "~/.config/fish/functions/config.fish"; then
echo "config.fish already exist, please rename to continue."
exit 1
fi
cp fish/config.fish ~/.config/fish/functions/
# copy fishfile
if test -f "~/.config/fish/fish_plugins"; then
echo "fish_plugins already exist, please rename to continue."
exit 1
fi
cp fish/fish_plugins ~/.config/fish/
echo "set --export PYENV_ROOT $HOME/.pyenv" > ~/.config/fish/conf.d/pyenv.fish
# install packages from fishfile
fish -c "fisher install jorgebucaran/fisher"
fish -c "fisher install (pwd)/fish/theme-t31m"
fish -c "fisher install FabioAntunes/fish-nvm"
fish -c "fisher update"
# set fish default shell
echo "Change your default Shell to FiSH: chsh -s /usr/bin/fish"
# cp vimrc
echo "Installing .vimrc"
cp dot.vimrc ~/.vimrc

24
main.sh
View File

@ -1,24 +0,0 @@
#!/bin/bash
USER=t31m
# update repos + system
apt-get update && apt-get upgrade
# install env packages
apt-get install git fish fzf build-essential jq vim curl -y
# pyenv dependencies ?
apt-get install python3-dev python3-setuptools python3-pip python3-smbus libffi-dev libssl-dev openssl zlib1g-dev libsqlite3-dev tk-dev libreadline-dev libbz2-dev -y
# install docker stable, if this failes try below
curl -fsSL https://get.docker.com | sh
#curl -fsSL https://test.docker.com | sh
# install docker-compose
curl -L https://github.com/docker/compose/releases/download/1.25.4/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
usermod -aG docker t31m
echo "Initial Setup Complete. Please run fish_setup.sh for env setup"