feat: add dotfiles auto setup on box creation
This commit is contained in:
parent
6aaf6e7842
commit
5eb1cb2618
3 changed files with 40 additions and 3 deletions
|
|
@ -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 .
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
28
boxes/devbox/scripts/fetch_dots
Normal file
28
boxes/devbox/scripts/fetch_dots
Normal 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue