feat: add dotfiles auto setup on box creation
All checks were successful
Publish image / Generate job matrices (push) Successful in 8s
Publish image / create-docker-images (map[name:devbox path:boxes/devbox]) (push) Successful in 3m18s

This commit is contained in:
Alexander Navarro 2024-11-11 15:20:09 -03:00
parent 6aaf6e7842
commit 5eb1cb2618
Signed by untrusted user who does not match committer: anavarro
GPG key ID: 6426043E9FA3E3B5
3 changed files with 40 additions and 3 deletions

View file

@ -14,10 +14,13 @@ FROM ghcr.io/void-linux/void-glibc-full:latest
# Setup void packages
RUN --mount=type=cache,target=/var/cache/xbps/ \
xbps-install -Syu \
bash \
bat \
cocogitto \
curl \
fd \
fzf \
gcc \
git \
lazygit \
neovim \
@ -38,6 +41,8 @@ RUN --mount=type=cache,target=/var/cache/xbps/ \
# Import cargo packages
COPY --from=rust-builder /usr/local/cargo/bin/* /usr/local/bin/
COPY ./scripts/fetch_dots /usr/local/bin/fetch_dots
# Set environment variables
ENV EDITOR=nvim \
VISUAL=nvim \
@ -49,7 +54,8 @@ ENV EDITOR=nvim \
# Basic setup
RUN \
# chsh -s /usr/bin/nu ## TODO: first create a configuration for nu
chsh -s /bin/zsh
chsh -s /usr/bin/zsh \
&& chmod +x /usr/local/bin/fetch_dots
# Build commands:
# Docker: docker build -t devbox .

View file

@ -7,8 +7,11 @@ init=true
root=false
start_now=true
home="${HOME}/chroots/devbox"
volume="${HOME}/.ssh:${HOME}/chroots/devbox/.ssh"
additional_packages=""
additional_flags="--hostname devbox"
home="${HOME}/chroots/devbox"
volume="${HOME}/.ssh:${HOME}/chroots/devbox/.ssh"
init_hooks=sudo -u aleidk sh -c "/usr/local/bin/fetch_dots"
init_hooks=rm /usr/local/bin/fetch_dots

View file

@ -0,0 +1,28 @@
#!/usr/bin/env bash
set -e pipefail
base_dir="$HOME/Repos/Private/"
mkdir -p "$base_dir"
cd "$base_dir" || exit
if [ -d dots ]; then
echo "Dots already exists, updating..."
cd dots || exit
git pull
else
git clone ssh://git@git.alecodes.page:24062/alecodes/dots.git
cd dots || exit
git checkout dotter-migration
fi
echo "Fixing permissions..."
chown -R 1000:1000 "$base_dir"
echo "Deploying dots..."
dotter deploy