Seems clean

This commit is contained in:
j 2025-07-26 00:04:42 +10:00
parent 3bf60ffda8
commit fc34525755
5 changed files with 155 additions and 2 deletions

View file

@ -1,3 +1,41 @@
# devenv
A simple method of utilizing Docker for your dev environment. Specifically
designed for use on X11 systems.
Docker based dev environments.
# Why X11?
X11 runs a server which allows you to pass through windows. Kind of like x
forwarding with SSH I supposed, except you pass through all the sockets and
shit.
This means that you can define dev environments for specific purposes and then
run them when they are needed.
If that involves opening an IDE or testing a Flutter app then it seems to all
happen as if it's on your machine.
No Qemu, just running binaries in Docker.
# Fast & Loose
I'm not using Docker the way that I preech in this.
I use Dockerfiles to define each dev env so that I don't have to actively
maintain it on my machine. I keep this repo on my home machine but also my work
machine, so that when I keep configurations in sync easily.
I may keep multiple binaries running in each container.
None of this is really how you're meant to use Docker however it's a nice,
simple method of achieving what Snap and Flatpak sort-of tried to achieve in
some ways.
# Installation
Clone repo.
Populate configuration files in base for git, nvim and tmux.
Build and run base.
You can map your configuraitons or whatever. I like to build them into the
images, because my vim confs get pretty weighty.

62
base/Dockerfile Normal file
View file

@ -0,0 +1,62 @@
FROM archlinux:latest
# Update
RUN pacman -Syu --noconfirm
## Configure non-root user
RUN pacman -S --noconfirm sudo
RUN useradd -m -s /bin/bash -G wheel x
RUN PASS=$(openssl rand -base64 14) && echo "x:$PASS" | chpasswd && echo "Pass $PASS"
RUN echo 'x ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
USER x
WORKDIR /home/x
## Install Yay incase we need it
RUN sudo pacman -S --noconfirm git base-devel
RUN git clone https://aur.archlinux.org/yay.git \
&& cd yay \
&& makepkg -si --noconfirm \
&& cd .. && rm -rf yay \
&& yay -Syu
## Install Neovim
RUN sudo pacman -S --needed --noconfirm \
neovim git curl unzip tar wget \
nodejs npm \
python python-pip \
lua \
go \
ripgrep \
fd \
gcc make base-devel \
xclip xsel wl-clipboard \
lazygit
RUN yay -S --noconfirm terraform-ls
RUN mkdir -p /home/x/.config/
COPY ./nvim /home/x/.config/nvim
# Should run Lazy update and keep the base image reasonably up to date
# Just to avoid lengthy startups but we'll see how this approach goes.
RUN nvim --headless "+Lazy! update" +qa
# Install Tmux
RUN sudo pacman -S --noconfirm tmux
COPY tmux/tmux.conf /home/x/.tmux.conf
## Git
# Should already be installed for Yay but repeating stuff to keep everything in blocks
RUN sudo pacman -S --noconfirm git
RUN mkdir -p /home/x/.config/git
COPY git/gitconfig /home/x/.gitconfig
COPY git/confs/ /home/x/.config/git/
## Tofu
# Might run into version issues because AUR isn't a versioned repo.
RUN yay -S --noconfirm opentofu
## AWS CLI
RUN yay -S --noconfirm aws-cli-v2
## Quick drop password at end of build output
RUN echo "Your password: $PASS"
ENTRYPOINT ["/bin/bash"]

11
base/git/gitconfig Normal file
View file

@ -0,0 +1,11 @@
[includeIf "gitdir:/home/x/Projects/xestro/"]
path = ~/.config/git/xestro.conf
[includeIf "gitdir:/home/x/Projects/repobase/"]
path = ~/.config/git/repobase.conf
[includeIf "gitdir:/home/x/Projects/gitlab/"]
path = ~/.config/git/gitlab.conf
[includeIf "gitdir:/home/x/Projects/github/"]
path = ~/.config/git/github.conf

15
flutter/Dockerfile Normal file
View file

@ -0,0 +1,15 @@
FROM d:base
USER root
RUN pacman -Syu --noconfirm base-devel cmake ninja clang pkgconf gtk3 libxcb
RUN git clone https://github.com/flutter/flutter.git /opt/flutter \
&& chown -R x:x /opt/flutter
USER x
ENV PATH="/opt/flutter/bin:${PATH}"
RUN flutter doctor
WORKDIR /home/x/Projects

27
run.sh Normal file
View file

@ -0,0 +1,27 @@
#!/bin/bash
docker_run() {
xhost +local:docker
docker run -it --rm \
-u "${UID}:${GID}" \
-v $HOME/Projects:/home/x/Projects \
-v ${HOME}/.Xauthority:/home/x/.Xauthority \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-e DISPLAY=${DISPLAY} \
--device /dev/dri \
--group-add video \
-v /var/run/docker.sock:/var/run/docker.sock \
--entrypoint /usr/bin/tmux \
d:${1}
}
docker_build() {
docker build ./${1} -t d:${1}
}
case "$1" in
*)
docker_build $1 && docker_run $1
;;
esac