diff --git a/boxes/devbox/.justfile b/boxes/devbox/.justfile new file mode 100644 index 0000000..3d15b8b --- /dev/null +++ b/boxes/devbox/.justfile @@ -0,0 +1,21 @@ +clean := "false" +box_name := file_stem(invocation_directory()) + +unexport GOBIN +unexport GOPATH +unexport GOROOT + + +# Create a new box from current directory +[no-cd] +build box_name: + [[ "{{clean}}" == "true" ]] && sudo rm -rf ${HOME}/chroots/{{ box_name }} || true + + podman build -t {{box_name}}:latest . + + distrobox assemble create + +# Enter the box +enter box_name: + clear + @distrobox enter --clean-path --no-workdir {{box_name}} diff --git a/boxes/devbox/Dockerfile b/boxes/devbox/Dockerfile index a332565..aa7f5fb 100644 --- a/boxes/devbox/Dockerfile +++ b/boxes/devbox/Dockerfile @@ -14,17 +14,20 @@ FROM ghcr.io/void-linux/void-glibc-full:latest # Setup void packages RUN --mount=type=cache,target=/var/cache/xbps/ \ xbps-install -Syu \ + && xbps-install -Sy \ bash \ bat \ cocogitto \ curl \ + eza \ fd \ fzf \ gcc \ git \ + just \ lazygit \ neovim \ - nushell \ + nodejs \ ripgrep \ sd \ starship \ @@ -41,7 +44,7 @@ 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 +COPY ./scripts/* /usr/local/bin/ # Set environment variables ENV EDITOR=nvim \ @@ -49,13 +52,13 @@ ENV EDITOR=nvim \ TERM=xterm-256color \ LANG=en_US.UTF-8 \ LC_ALL=en_US.UTF-8 \ - SHELL=/bin/zsh + SHELL=/usr/bin/zsh # Basic setup RUN \ - # chsh -s /usr/bin/nu ## TODO: first create a configuration for nu + # chsh -s /usr/bin/nu \ chsh -s /usr/bin/zsh \ - && chmod +x /usr/local/bin/fetch_dots + && chmod +x /usr/local/bin/* # Build commands: # Docker: docker build -t devbox . diff --git a/boxes/devbox/distrobox.ini b/boxes/devbox/distrobox.ini index 3c9069e..e459b93 100644 --- a/boxes/devbox/distrobox.ini +++ b/boxes/devbox/distrobox.ini @@ -13,5 +13,4 @@ volume="${HOME}/.ssh:${HOME}/chroots/devbox/.ssh" additional_packages="" additional_flags="--hostname devbox" -init_hooks=sudo -u aleidk sh -c "/usr/local/bin/fetch_dots" -init_hooks=rm /usr/local/bin/fetch_dots +init_hooks=if [ -e /usr/local/bin/fetch_dots ]; then sudo -u aleidk sh -c "/usr/local/bin/fetch_dots" && rm /usr/local/bin/fetch_dots; fi diff --git a/boxes/devbox/scripts/fetch_dots b/boxes/devbox/scripts/fetch_dots index a4440df..c802d5d 100644 --- a/boxes/devbox/scripts/fetch_dots +++ b/boxes/devbox/scripts/fetch_dots @@ -11,7 +11,7 @@ cd "$base_dir" || exit if [ -d dots ]; then echo "Dots already exists, updating..." cd dots || exit - git pull + git pull --rebase --autostash else git clone ssh://git@git.alecodes.page:24062/alecodes/dots.git diff --git a/boxes/devbox/scripts/setup_go b/boxes/devbox/scripts/setup_go new file mode 100644 index 0000000..c3ee02e --- /dev/null +++ b/boxes/devbox/scripts/setup_go @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +set -e pipefail + +sudo xbps-install -Sy go + +go install mvdan.cc/gofumpt@latest +go install -v github.com/incu6us/goimports-reviser/v3@latest +go install github.com/segmentio/golines@latest +go install golang.org/x/tools/gopls@latest