Skip to content
Snippets Groups Projects
Commit c27232ea authored by Montaño Sarria, Andres Felipe's avatar Montaño Sarria, Andres Felipe
Browse files

Migrating to unified dotfiles managed by homeshick

parent 42c1161a
Branches
No related tags found
No related merge requests found
ARG ROS_DISTRO ARG ROS_DISTRO
FROM osrf/ros:${ROS_DISTRO}-desktop-full FROM osrf/ros:${ROS_DISTRO}-desktop-full
ARG SHELL ARG EXT_SHELL
RUN echo "Building devenv for ROS" $ROS_DISTRO "with shell" $SHELL RUN echo "Building devenv for ROS" $ROS_DISTRO "with shell" $EXT_SHELL
# Avoid warnings by switching to noninteractive # Avoid warnings by switching to noninteractive
ENV DEBIAN_FRONTEND=noninteractive ENV DEBIAN_FRONTEND=noninteractive
...@@ -46,9 +46,10 @@ RUN apt-get update && \ ...@@ -46,9 +46,10 @@ RUN apt-get update && \
openssh-client \ openssh-client \
trash-cli \ trash-cli \
valgrind \ valgrind \
wget wget \
xterm
RUN if [ "$SHELL" = "zsh" ]; \ RUN if [ "$EXT_SHELL" = "zsh" ]; \
then \ then \
apt-get -y install zsh; \ apt-get -y install zsh; \
fi fi
...@@ -129,6 +130,9 @@ RUN if [ "${ROS_DISTRO}" != "humble" ]; \ ...@@ -129,6 +130,9 @@ RUN if [ "${ROS_DISTRO}" != "humble" ]; \
ros-${ROS_DISTRO}-rosmon \ ros-${ROS_DISTRO}-rosmon \
ros-${ROS_DISTRO}-rqt-controller-manager \ ros-${ROS_DISTRO}-rqt-controller-manager \
ros-${ROS_DISTRO}-rqt-joint-trajectory-controller; \ ros-${ROS_DISTRO}-rqt-joint-trajectory-controller; \
else \
apt-get update && \
apt-get -y install python3-colcon-common-extensions; \
fi fi
# Copy the requirements.txt file into the container # Copy the requirements.txt file into the container
...@@ -146,7 +150,7 @@ RUN if [ -f "${ROS_DISTRO}_requirements.txt" ]; \ ...@@ -146,7 +150,7 @@ RUN if [ -f "${ROS_DISTRO}_requirements.txt" ]; \
RUN rm -rf * RUN rm -rf *
# Update this date to re-run the image final update # Update this date to re-run the image final update
LABEL image.date=17-10-2023 LABEL image.date=23-10-2023
# Update final image # Update final image
RUN apt-get update \ RUN apt-get update \
...@@ -159,13 +163,15 @@ COPY ./ros_entrypoint.sh / ...@@ -159,13 +163,15 @@ COPY ./ros_entrypoint.sh /
RUN chmod a+x /ros_entrypoint.sh RUN chmod a+x /ros_entrypoint.sh
ENV ROS_DISTRO "${ROS_DISTRO}" ENV ROS_DISTRO "${ROS_DISTRO}"
ENV SHELL "${SHELL}"
ENV RUNNING_IN_DOCKER true
# SHELL ["/bin/${SHELL}"] ENV EXT_SHELL "${EXT_SHELL}"
ENV RUNNING_IN_DOCKER true
# Switch back to dialog for any ad-hoc use of apt-get # Switch back to dialog for any ad-hoc use of apt-get
ENV DEBIAN_FRONTEND= ENV DEBIAN_FRONTEND=
ARG SHELL
ENV SHELL "${SHELL}"
ENTRYPOINT ["/ros_entrypoint.sh"] ENTRYPOINT ["/ros_entrypoint.sh"]
CMD /usr/bin/$SHELL CMD $EXT_SHELL
\ No newline at end of file \ No newline at end of file
# 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
#zmodload zsh/zprof #zmodload zsh/zprof
# If you come from bash you might have to change your $PATH. # If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH export PATH=$HOME/apps:$PATH
export PATH=$HOME/apps/xela_server:$PATH
# Path to your oh-my-zsh installation. # Path to your oh-my-zsh installation.
export ZSH=~/.oh-my-zsh export ZSH=~/.oh-my-zsh
...@@ -19,7 +13,7 @@ COMPLETION_WAITING_DOTS="true" ...@@ -19,7 +13,7 @@ COMPLETION_WAITING_DOTS="true"
source "$HOME/.homesick/repos/homeshick/homeshick.sh" source "$HOME/.homesick/repos/homeshick/homeshick.sh"
fpath=($HOME/.homesick/repos/homeshick/completions $fpath) fpath=($HOME/.homesick/repos/homeshick/completions $fpath)
source ~/antigen.zsh source ~/apps/antigen.zsh
antigen use oh-my-zsh antigen use oh-my-zsh
antigen theme romkatv/powerlevel10k antigen theme romkatv/powerlevel10k
...@@ -40,24 +34,21 @@ antigen bundle zsh-users/zsh-autosuggestions ...@@ -40,24 +34,21 @@ antigen bundle zsh-users/zsh-autosuggestions
antigen apply antigen apply
#ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=0' ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=0'
# *********************
# command-line fuzzy finder # command-line fuzzy finder
# *********************
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
source $HOME/.init_shell
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
#zprof
export FZF_DEFAULT_COMMAND='rg --files --hidden --follow --no-ignore-vcs' export FZF_DEFAULT_COMMAND='rg --files --hidden --follow --no-ignore-vcs'
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND" export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
#export FZF_ALT_C_COMMAND="fd -t d --hidden --follow --exclude \".git\" . $HOME"
export FZF_ALT_C_COMMAND="fd -t d --hidden --follow --exclude \".git\" ." export FZF_ALT_C_COMMAND="fd -t d --hidden --follow --exclude \".git\" ."
# *********************
# zsh cache compdump
# *********************
# Create a cache folder if it isn't exists # Create a cache folder if it isn't exists
if [ ! -d "$HOME/.cache/zsh" ]; then if [ ! -d "$HOME/.cache/zsh" ]; then
mkdir -p $HOME/.cache/zsh mkdir -p $HOME/.cache/zsh
...@@ -66,21 +57,26 @@ fi ...@@ -66,21 +57,26 @@ fi
# Define a custom file for compdump # Define a custom file for compdump
export ZSH_COMPDUMP="$HOME/.cache/zsh/zcompdump-$HOST-$ZSH_VERSION" export ZSH_COMPDUMP="$HOME/.cache/zsh/zcompdump-$HOST-$ZSH_VERSION"
# *********************
# User configuration # User configuration
# *********************
# Use code as default editor
export EDITOR="code -r" export EDITOR="code -r"
source $HOME/.init_shell
# Include dotfiles # Include dotfiles
source ${HOME}/srcs/development_environment/dotfiles/git.bash source "$HOME/.homesick/repos/dotfiles/home/system.sh"
source ${HOME}/srcs/development_environment/dotfiles/docker.bash source "$HOME/.homesick/repos/dotfiles/home/git.sh"
source ${HOME}/srcs/development_environment/dotfiles/ros.bash source "$HOME/.homesick/repos/dotfiles/home/docker.sh"
source ${HOME}/srcs/development_environment/dotfiles/system.bash source "$HOME/.homesick/repos/dotfiles/home/ros.sh"
# To add direnv app if [ -f ~/.bash_aliases ]; then
# eval "$(direnv hook zsh)" . ~/.bash_aliases
fi
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh. # To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh [[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
# Finalize Powerlevel10k instant prompt. Should stay at the bottom of ~/.zshrc. #zprof
(( ! ${+functions[p10k-instant-prompt-finalize]} )) || p10k-instant-prompt-finalize
...@@ -15,21 +15,21 @@ function dockbuild(){ ...@@ -15,21 +15,21 @@ function dockbuild(){
if [ $# -lt 1 ]; then if [ $# -lt 1 ]; then
echo "Usage: dockbuild <ROS_DISTRO> [build_args]" echo "Usage: dockbuild <ROS_DISTRO> [build_args]"
echo "build_args:" echo "build_args:"
echo " SHELL - zsh (default) or bash" echo " EXT_SHELL - zsh (default) or bash"
return 1 return 1
fi fi
cd $dockerfiles_DIR; cd $dockerfiles_DIR;
if [ $# -lt 2 ]; then if [ $# -lt 2 ]; then
echo "Building ROS_DISTRO:"$1 "with SHELL_VERISON: zsh" echo "Building ROS_DISTRO:"$1 "with SHELL_VERSION: zsh"
docker build -t devenv:$1 --build-arg ROS_DISTRO=$1 --build-arg SHELL="zsh" -f devenv.Dockerfile . docker build -t devenv:$1 --build-arg ROS_DISTRO=$1 --build-arg EXT_SHELL="zsh" --build-arg SHELL="/usr/bin/zsh" -f devenv.Dockerfile .
else else
if [ $2 = "bash" ]; then if [ $2 = "bash" ]; then
echo "Building ROS_DISTRO:"$1 "with SHELL_VERISON:"$2 echo "Building ROS_DISTRO:"$1 "with SHELL_VERSION:"$2
docker build -t devenv:$1 --build-arg ROS_DISTRO=$1 --build-arg SHELL=$2 -f devenv.Dockerfile . docker build -t devenv:$1 --build-arg ROS_DISTRO=$1 --build-arg EXT_SHELL="bash" --build-arg SHELL="/bin/bash" -f devenv.Dockerfile .
else else
echo "SHELL_VERISON:"$2 "not supported" echo "SHELL_VERSION:"$2 "not supported"
fi fi
fi fi
} }
......
...@@ -15,7 +15,15 @@ if [[ -z "${ROS_DISTRO}" ]]; then ...@@ -15,7 +15,15 @@ if [[ -z "${ROS_DISTRO}" ]]; then
fi fi
# Determine shell extension # Determine shell extension
if [ -z $SHELL ]; then echo "SHELL not set"; else ext=$(basename ${SHELL}); fi if [ ! -z $EXT_SHELL ]; then
if [ -z $SHELL ]; then
echo "SHELL not set"
export SHELL=/usr/bin/zsh
ext=$(basename ${SHELL});
else
ext=$(basename ${SHELL});
fi
fi
# Source rosmon # Source rosmon
function smon(){ function smon(){
...@@ -26,13 +34,23 @@ function smon(){ ...@@ -26,13 +34,23 @@ function smon(){
# cd to the root of the workspace # cd to the root of the workspace
function roshome(){ function roshome(){
if command -v roscd &> /dev/null
then
roscd && cd .. roscd && cd ..
ROS_HOME=${PWD} ROS_HOME=${PWD}
else
echo "command ** roscd ** not found"
fi
} }
# Source the current workspace # Source the current workspace
function sourcews(){ function sourcews(){
if [ "${ROS_VERSION}" = 1 ]
then
source ./devel/setup.${ext} && smon source ./devel/setup.${ext} && smon
else
source ./install/setup.${ext}
fi
} }
# Source the current workspace # Source the current workspace
...@@ -51,16 +69,27 @@ function sourcethis(){ ...@@ -51,16 +69,27 @@ function sourcethis(){
# Automatic catkin build # Automatic catkin build
function cb() { function cb() {
if [ "${ROS_VERSION}" = 1 ]
then
pwd_cb=${PWD} pwd_cb=${PWD}
roshome roshome
catkin build --summarize --cmake-args -DCMAKE_BUILD_TYPE=Release -- "$@" catkin build --summarize --cmake-args -DCMAKE_BUILD_TYPE=Release -- "$@"
sourcethis sourcethis
cd ${pwd_cb} cd ${pwd_cb}
else
colcon build --parallel-workers 6 "$@"
source ./install/setup.zsh
fi
} }
# Clean workspace (delete the generated folders, then catkin build) # Clean workspace (delete the generated folders, then catkin build)
function cbclean(){ function cbclean(){
if [ "${ROS_VERSION}" = 1 ]
then
roshome && rm -rf build devel install && catkin build --summarize --cmake-args -DCMAKE_BUILD_TYPE=Release roshome && rm -rf build devel install && catkin build --summarize --cmake-args -DCMAKE_BUILD_TYPE=Release
else
rm -rf build devel install && cb
fi
} }
# Initialize catkin workspace, configure and build it # Initialize catkin workspace, configure and build it
...@@ -99,4 +128,4 @@ else ...@@ -99,4 +128,4 @@ else
fi fi
fi fi
alias sc=sourcethis #alias sc=sourcethis
\ No newline at end of file \ No newline at end of file
# Override globalalias config
# space expands all aliases, including global
bindkey -M emacs "^ " globalias
bindkey -M viins "^ " globalias
# control-space to make a normal space
bindkey -M emacs " " magic-space
bindkey -M viins " " magic-space
# normal space during searches
bindkey -M isearch " " magic-space
# Determine shell extension
if [ -z $SHELL ]; then
echo "SHELL not set"
export SHELL=/usr/bin/zsh
ext=$(basename ${SHELL});
else
ext=$(basename ${SHELL});
fi
# lsd
if command -v lsd &> /dev/null if command -v lsd &> /dev/null
then then
# Directories # Directories
...@@ -15,6 +36,7 @@ else ...@@ -15,6 +36,7 @@ else
alias ls='ls' alias ls='ls'
fi fi
# bat ==> cat
if command -v bat &> /dev/null if command -v bat &> /dev/null
then then
# Files # Files
...@@ -27,4 +49,5 @@ then ...@@ -27,4 +49,5 @@ then
alias ipy='ipython' alias ipy='ipython'
fi fi
alias mountT='sudo mount -t cifs //tri.lan/tri /mnt/T --verbose -o username=110343,password=Bageera\#1983,workgroup=TRI.LAN' # Tecnalia T
alias mountT='sudo mount -t cifs //tri.lan/tri /mnt/T --verbose -o username=110343,password=Iris\#1983,workgroup=TRI.LAN'
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment