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
FROM osrf/ros:${ROS_DISTRO}-desktop-full
ARG SHELL
RUN echo "Building devenv for ROS" $ROS_DISTRO "with shell" $SHELL
ARG EXT_SHELL
RUN echo "Building devenv for ROS" $ROS_DISTRO "with shell" $EXT_SHELL
# Avoid warnings by switching to noninteractive
ENV DEBIAN_FRONTEND=noninteractive
......@@ -46,9 +46,10 @@ RUN apt-get update && \
openssh-client \
trash-cli \
valgrind \
wget
wget \
xterm
RUN if [ "$SHELL" = "zsh" ]; \
RUN if [ "$EXT_SHELL" = "zsh" ]; \
then \
apt-get -y install zsh; \
fi
......@@ -129,6 +130,9 @@ RUN if [ "${ROS_DISTRO}" != "humble" ]; \
ros-${ROS_DISTRO}-rosmon \
ros-${ROS_DISTRO}-rqt-controller-manager \
ros-${ROS_DISTRO}-rqt-joint-trajectory-controller; \
else \
apt-get update && \
apt-get -y install python3-colcon-common-extensions; \
fi
# Copy the requirements.txt file into the container
......@@ -146,7 +150,7 @@ RUN if [ -f "${ROS_DISTRO}_requirements.txt" ]; \
RUN rm -rf *
# 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
RUN apt-get update \
......@@ -159,13 +163,15 @@ COPY ./ros_entrypoint.sh /
RUN chmod a+x /ros_entrypoint.sh
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
ENV DEBIAN_FRONTEND=
ARG SHELL
ENV SHELL "${SHELL}"
ENTRYPOINT ["/ros_entrypoint.sh"]
CMD /usr/bin/$SHELL
\ No newline at end of file
CMD $EXT_SHELL
\ 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
# 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.
export ZSH=~/.oh-my-zsh
......@@ -19,7 +13,7 @@ COMPLETION_WAITING_DOTS="true"
source "$HOME/.homesick/repos/homeshick/homeshick.sh"
fpath=($HOME/.homesick/repos/homeshick/completions $fpath)
source ~/antigen.zsh
source ~/apps/antigen.zsh
antigen use oh-my-zsh
antigen theme romkatv/powerlevel10k
......@@ -40,24 +34,21 @@ antigen bundle zsh-users/zsh-autosuggestions
antigen apply
#ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=0'
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=0'
# *********************
# command-line fuzzy finder
# *********************
[ -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_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\" ."
# *********************
# zsh cache compdump
# *********************
# Create a cache folder if it isn't exists
if [ ! -d "$HOME/.cache/zsh" ]; then
mkdir -p $HOME/.cache/zsh
......@@ -66,21 +57,26 @@ fi
# Define a custom file for compdump
export ZSH_COMPDUMP="$HOME/.cache/zsh/zcompdump-$HOST-$ZSH_VERSION"
# *********************
# User configuration
# *********************
# Use code as default editor
export EDITOR="code -r"
source $HOME/.init_shell
# Include dotfiles
source ${HOME}/srcs/development_environment/dotfiles/git.bash
source ${HOME}/srcs/development_environment/dotfiles/docker.bash
source ${HOME}/srcs/development_environment/dotfiles/ros.bash
source ${HOME}/srcs/development_environment/dotfiles/system.bash
source "$HOME/.homesick/repos/dotfiles/home/system.sh"
source "$HOME/.homesick/repos/dotfiles/home/git.sh"
source "$HOME/.homesick/repos/dotfiles/home/docker.sh"
source "$HOME/.homesick/repos/dotfiles/home/ros.sh"
# To add direnv app
# eval "$(direnv hook zsh)"
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
# Finalize Powerlevel10k instant prompt. Should stay at the bottom of ~/.zshrc.
(( ! ${+functions[p10k-instant-prompt-finalize]} )) || p10k-instant-prompt-finalize
#zprof
......@@ -15,21 +15,21 @@ function dockbuild(){
if [ $# -lt 1 ]; then
echo "Usage: dockbuild <ROS_DISTRO> [build_args]"
echo "build_args:"
echo " SHELL - zsh (default) or bash"
echo " EXT_SHELL - zsh (default) or bash"
return 1
fi
cd $dockerfiles_DIR;
if [ $# -lt 2 ]; then
echo "Building ROS_DISTRO:"$1 "with SHELL_VERISON: zsh"
docker build -t devenv:$1 --build-arg ROS_DISTRO=$1 --build-arg SHELL="zsh" -f devenv.Dockerfile .
echo "Building ROS_DISTRO:"$1 "with SHELL_VERSION: zsh"
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
if [ $2 = "bash" ]; then
echo "Building ROS_DISTRO:"$1 "with SHELL_VERISON:"$2
docker build -t devenv:$1 --build-arg ROS_DISTRO=$1 --build-arg SHELL=$2 -f devenv.Dockerfile .
echo "Building ROS_DISTRO:"$1 "with SHELL_VERSION:"$2
docker build -t devenv:$1 --build-arg ROS_DISTRO=$1 --build-arg EXT_SHELL="bash" --build-arg SHELL="/bin/bash" -f devenv.Dockerfile .
else
echo "SHELL_VERISON:"$2 "not supported"
echo "SHELL_VERSION:"$2 "not supported"
fi
fi
}
......
......@@ -15,7 +15,15 @@ if [[ -z "${ROS_DISTRO}" ]]; then
fi
# 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
function smon(){
......@@ -26,13 +34,23 @@ function smon(){
# cd to the root of the workspace
function roshome(){
if command -v roscd &> /dev/null
then
roscd && cd ..
ROS_HOME=${PWD}
else
echo "command ** roscd ** not found"
fi
}
# Source the current workspace
function sourcews(){
if [ "${ROS_VERSION}" = 1 ]
then
source ./devel/setup.${ext} && smon
else
source ./install/setup.${ext}
fi
}
# Source the current workspace
......@@ -51,16 +69,27 @@ function sourcethis(){
# Automatic catkin build
function cb() {
if [ "${ROS_VERSION}" = 1 ]
then
pwd_cb=${PWD}
roshome
catkin build --summarize --cmake-args -DCMAKE_BUILD_TYPE=Release -- "$@"
sourcethis
cd ${pwd_cb}
else
colcon build --parallel-workers 6 "$@"
source ./install/setup.zsh
fi
}
# Clean workspace (delete the generated folders, then catkin build)
function cbclean(){
if [ "${ROS_VERSION}" = 1 ]
then
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
......@@ -99,4 +128,4 @@ else
fi
fi
alias sc=sourcethis
\ No newline at end of file
#alias sc=sourcethis
\ 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
then
# Directories
......@@ -15,6 +36,7 @@ else
alias ls='ls'
fi
# bat ==> cat
if command -v bat &> /dev/null
then
# Files
......@@ -27,4 +49,5 @@ then
alias ipy='ipython'
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