├── Dockerfile ├── LICENSE ├── README.md └── helpers ├── add-aur.sh ├── config.lua ├── containers.conf ├── initial_setup.zsh ├── intro.png ├── podman-containers.conf └── webdevbox.zsh /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM docker.io/library/archlinux as update-mirrors 2 | ARG PACMAN_PARALLELDOWNLOADS=5 3 | RUN pacman-key --init \ 4 | && pacman-key --populate archlinux \ 5 | && sed 's/ParallelDownloads = \d+/ParallelDownloads = ${PACMAN_PARALLELDOWNLOADS}/g' -i /etc/pacman.conf \ 6 | && sed 's/NoProgressBar/#NoProgressBar/g' -i /etc/pacman.conf 7 | 8 | # update mirrorlist 9 | #ADD https://raw.githubusercontent.com/greyltc/docker-archlinux/master/get-new-mirrors.sh /usr/bin/get-new-mirrors 10 | #RUN chmod +x /usr/bin/get-new-mirrors 11 | #RUN get-new-mirrors 12 | RUN sed -i 's/^Server = https:\/\/.*/Server = https:\/\/archlinux.c3sl.ufpr.br\/$repo\/os\/$arch/' /etc/pacman.d/mirrorlist 13 | 14 | RUN pacman -Syyu --noconfirm \ 15 | aardvark-dns \ 16 | apparmor \ 17 | atuin \ 18 | base-devel \ 19 | bat \ 20 | chromium \ 21 | chezmoi \ 22 | cifs-utils \ 23 | curl \ 24 | dust \ 25 | elixir \ 26 | exa \ 27 | fd \ 28 | ffmpeg \ 29 | fish \ 30 | fzf \ 31 | fuse-overlayfs \ 32 | gitlab-runner \ 33 | git \ 34 | git-lfs \ 35 | go \ 36 | helm \ 37 | htop \ 38 | imagemagick \ 39 | links \ 40 | lsof \ 41 | jdk11-openjdk \ 42 | jdk8-openjdk \ 43 | jq \ 44 | mariadb-clients \ 45 | memcached \ 46 | neovim \ 47 | opencv \ 48 | openssh \ 49 | pgcli \ 50 | php \ 51 | podman \ 52 | podman-compose \ 53 | podman-docker \ 54 | podman-dnsname \ 55 | postgresql-libs \ 56 | procs \ 57 | redis \ 58 | ripgrep \ 59 | rust \ 60 | starship \ 61 | strace \ 62 | sqlite3 \ 63 | sudo \ 64 | terraform \ 65 | tmux \ 66 | tmuxp \ 67 | unzip \ 68 | wget \ 69 | wl-clipboard \ 70 | xsel \ 71 | xclip \ 72 | yarn \ 73 | zellij \ 74 | zsh-autosuggestions \ 75 | zsh-completions \ 76 | zsh-history-substring-search \ 77 | zsh-syntax-highlighting \ 78 | zsh-theme-powerlevel10k \ 79 | ; pacman -Rns $(pacman -Qtdq) \ 80 | ; pacman -Scc --noconfirm \ 81 | ; rm -Rf /var/cache/pacman/pkg/* 82 | 83 | RUN archlinux-java set java-8-openjdk 84 | 85 | # optional directory to mount the host's home directory 86 | RUN mkdir -p /mnt/host 87 | 88 | # Install Yay and continue with it 89 | FROM update-mirrors as build-helper-img 90 | ARG AUR_USER=builduser 91 | ARG HELPER=yay 92 | ARG LUNARVIM_VERSION=1.3 93 | ARG NEOVIM_VERSION=0.9 94 | 95 | ADD helpers/add-aur.sh /root 96 | RUN bash /root/add-aur.sh ${AUR_USER} ${HELPER} 97 | 98 | # azure and google packages, each are more than 600 MB, uncompressed 99 | # insomnia and postman, are also each larger than 300 MB 100 | # dunno if they're worth having built-in. leaving just insomnia 101 | RUN aur-install \ 102 | asdf-vm \ 103 | aws-cli \ 104 | # azure-cli-bin \ 105 | fselect-bin \ 106 | # google-cloud-sdk \ heroku-cli-bin \ 107 | insomnia-bin \ 108 | kubectl-bin \ 109 | kustomize-bin \ 110 | openshift-client-bin \ 111 | # postman-bin \ 112 | skaffold-bin \ 113 | terragrunt \ 114 | tldr \ 115 | urlview \ 116 | wrk \ 117 | zsh-git-prompt \ 118 | zsh-vi-mode \ 119 | ; pacman -Rns $(pacman -Qtdq) \ 120 | ; pacman -Scc --noconfirm \ 121 | ; rm -Rf .cache/yay/* \ 122 | ; rm -Rf /var/cache/foreign-pkg/* 123 | 124 | RUN source /opt/asdf-vm/asdf.sh \ 125 | && asdf plugin-add crystal \ 126 | && asdf plugin-add dotnet-core \ 127 | && asdf plugin-add elixir \ 128 | && asdf plugin-add erlang \ 129 | && asdf plugin-add golang \ 130 | && asdf plugin-add haskell \ 131 | && asdf plugin-add java \ 132 | && asdf plugin-add julia \ 133 | && asdf plugin-add kotlin \ 134 | && asdf plugin-add lua \ 135 | && asdf plugin-add nim \ 136 | && asdf plugin-add nodejs \ 137 | && asdf plugin-add php \ 138 | && asdf plugin-add python \ 139 | && asdf plugin-add ruby \ 140 | && asdf plugin-add rust \ 141 | && asdf plugin-add scala \ 142 | && asdf plugin-add zig \ 143 | && asdf plugin-add python 144 | 145 | RUN source /opt/asdf-vm/asdf.sh && asdf install python latest && asdf install nodejs latest && asdf global python latest && asdf global nodejs latest 146 | 147 | RUN source /opt/asdf-vm/asdf.sh && LV_BRANCH="release-${LUNARVIM_VERSION}/neovim-${NEOVIM_VERSION}" \ 148 | bash <(curl -s https://raw.githubusercontent.com/lunarvim/lunarvim/master/utils/installer/install.sh) -y 149 | 150 | RUN mkdir -p /etc/skel/.local/share \ 151 | && mkdir -p /etc/skel/.local/bin \ 152 | && mkdir -p /etc/skel/.config/lvim \ 153 | && mv /root/.local/share/lunarvim /etc/skel/.local/share/lunarvim \ 154 | && mv /root/.local/bin/lvim /etc/skel/.local/bin/lvim \ 155 | && mv /root/.asdf /etc/skel/ \ 156 | && sed 's/\/root/$HOME/g' -i /etc/skel/.local/bin/lvim 157 | 158 | COPY helpers/config.lua /etc/skel/.config/lvim 159 | COPY helpers/webdevbox.zsh /etc/skel/.config/zsh/webdevbox.zsh 160 | COPY helpers/initial_setup.zsh /etc/skel/.zshrc 161 | 162 | USER root 163 | RUN touch /var/tmp/first-time.lock 164 | 165 | # configure podman for rootless 166 | RUN groupadd --system podman \ 167 | && useradd --system --shell /usr/bin/nologin --create-home --home-dir /home/podman podman -g podman \ 168 | && echo podman:10000:65536 > /etc/subuid \ 169 | && echo podman:10000:65536 > /etc/subgid 170 | 171 | VOLUME /var/lib/containers 172 | VOLUME /home/podman/.local/share/containers 173 | 174 | ADD helpers/containers.conf /etc/containers/containers.conf 175 | ADD helpers/podman-containers.conf /home/podman/.config/containers/containers.conf 176 | 177 | RUN chown podman:podman -R /home/podman 178 | 179 | # chmod containers.conf and adjust storage.conf to enable Fuse storage. 180 | RUN chmod 644 /etc/containers/containers.conf \ 181 | ; sed -i -e 's|^#mount_program|mount_program|g' \ 182 | -e '/additionalimage.*/a "/var/lib/shared",' \ 183 | -e 's|^mountopt[[:space:]]*=.*$|mountopt = "nodev,fsync=0"|g' \ 184 | -e '/#ignore_chown_errors = false/ignore_chown_errors = true/g' \ 185 | /etc/containers/storage.conf 186 | 187 | RUN mkdir -p /var/lib/shared/overlay-images \ 188 | /var/lib/shared/overlay-layers \ 189 | /var/lib/shared/vfs-images \ 190 | /var/lib/shared/vfs-layers \ 191 | ; touch /var/lib/shared/overlay-images/images.lock \ 192 | ; touch /var/lib/shared/overlay-layers/layers.lock \ 193 | ; touch /var/lib/shared/vfs-images/images.lock \ 194 | ; touch /var/lib/shared/vfs-layers/layers.lock 195 | 196 | ENV _CONTAINERS_USERNS_CONFIGURED="" 197 | 198 | RUN echo "source /opt/asdf-vm/asdf.sh" >> /etc/profile ;\ 199 | sed 's/PATH=/PATH=$HOME\/.local\/bin/g' -i /etc/profile 200 | 201 | CMD ["/bin/zsh"] 202 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2023 Fabio Akita 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ``` 2 | ___. .___ ___. 3 | __ _ __ ____\_ |__ __| _/_______ _\_ |__ _______ ___ 4 | \ \/ \/ // __ \| __ \ / __ |/ __ \ \/ /| __ \ / _ \ \/ / 5 | \ /\ ___/| \_\ \/ /_/ \ ___/\ / | \_\ ( <_> > < 6 | \/\_/ \___ >___ /\____ |\___ >\_/ |___ /\____/__/\_ \ 7 | \/ \/ \/ \/ \/ \/ 8 | 61 6B 69 74 61 6F 6E 72 61 69 6C 73 40 43 6F 64 65 4D 69 6E 65 72 34 32 9 | 10 | ``` 11 | 12 | [![WebDevBox DemoTEXT](https://github.com/akitaonrails/webdevbox/raw/main/helpers/intro.png)](https://player.vimeo.com/video/805780923?h=ddd98118f0 "WebDevBox Demo") 13 | 14 | ## Distrobox WebDevBox 15 | 16 | This is an Archlinux based Docker image that comes pre-installed with 17 | everything I think a web developer would need in the 2020s. Every language, every tool, every helper. 18 | 19 | Take a look at the [Dockerfile](Dockerfile) to see all packages, but in summary: 20 | 21 | * ZSH (of course) with several plugins 22 | * Chezmoi to sync your dotfiles 23 | * LunarVim already configured to work with TMUX 24 | * All major languages (Ruby, Nodejs, Python, PHP, Kotlin, etc) 25 | * ASDF so you can install specific old language versions for your projects 26 | * Podman by default, and every Devops tool (K8S, Skaffold, Helm, Terraform, etc) 27 | * All the normal debug tools (lsof, strace, etc) 28 | 29 | ## Usage 30 | 31 | First, install Podman in your OS (Docker works fine as well), for example, in Arch: 32 | 33 | $ sudo pacman -S podman 34 | 35 | Install Distrobox. I tried the "distrobox-git" package in AUR, but Distrobox is still in heavy development and I stumbled upon a old bug that was already solved in the main branch, so I recommend installing the "unstable" version manually: 36 | 37 | $ curl -s https://raw.githubusercontent.com/89luca89/distrobox/main/install | sudo sh -s -- --next 38 | 39 | Now you have 2 options. The easy one is to just pull the image from DockerHub: 40 | 41 | $ podman pull docker.io/akitaonrails/webdevbox:latest 42 | 43 | Or you can customize the Dockerfile and build it manually: 44 | 45 | $ git clone https://github.com/akitaonrails/webdevbox.git 46 | $ cd webdevbox 47 | $ podman build . -t akitaonrails/webdevbox 48 | 49 | Finally, it's normal Distrobox usage. Let's create the box and enter in it: 50 | 51 | $ mkdir -p ~/.local/share/distrobox/webdevbox 52 | 53 | $ distrobox create \ 54 | -i akitaonrails/webdevbox \ 55 | -n webdevbox-demo -I \ 56 | 57 | $ distrobox enter webdevbox-demo 58 | 59 | *WARNING:* Distrobox maps its internal home directory directly on top of your real home by default. It will automatically create a user with the same username as you are using right now, 60 | so it should be very seamleass to transition between them. But be careful that whatever destructive command you run over your home files, will be 61 | permanent. If you prefer not to expose your home directory directly, you can point the internal home to somewhere else, like this: 62 | 63 | $ distrobox create \ 64 | -i akitaonrails/webdevbox \ 65 | -n webdevbox-demo -I \ 66 | -H ~/.local/share/distrobox/webdevbox \ 67 | --volume $HOME:/mnt/host 68 | 69 | I prefer to map to a new directory and have a separated home per box. Then map my home as an external drive in "/mnt/host". 70 | 71 | Then we can initialize [Chezmoi](https://www.chezmoi.io/). I'd recommend first forking my [dotfiles repository](https://github.com/akitaonrails/dotfiles), but let's use it as example: 72 | 73 | $ chezmoi init https://github.com/akitaonrails/dotfiles 74 | $ chezmoi update 75 | 76 | It will prompt you for your specific information such as preferred Git email. I configured Tmux to have the key bind "Ctrl+Alt+n" to open a new pane directly to a text file to serve as a shortcut for times when you want to make quick notes or add reminders. I usually point to my Dropbox synced Obsidian directory, for example. 77 | 78 | And if you want to run Podman inside Distrobox (yes! you can run a new container inside another container, Podman is already configured to run rootless inside), and if you chose 79 | to map your home directory directly to your real home, then make sure to create the volume for the containers: 80 | 81 | $ mkdir -p $HOME/.local/share/containers/storage/ 82 | 83 | Whenever you `podman pull` inside the Box, the blobs will be stored there, so not to bloat the box itself. Remember that changes made inside the box are persistent. 84 | 85 | And that's it. You can start working! 86 | 87 | ## FAQ 88 | 89 | ### Did you configure Git Aliases? 90 | 91 | Yes, type `git la` to have a list of all the built-in aliases 92 | 93 | ### How can I see Tmux shortcuts? 94 | 95 | Type "Ctrl+b" and "?" to open a short (incomplete) list. But reading the ".tmux.conf" file is easier. 96 | 97 | ### How do I navigate in Tmux? 98 | 99 | The navigation key binding were customized. The same Ctrl+[hjkl] are used to navigate between 100 | both Tmux panels and LunarVim panels. 101 | 102 | I also configured navigaton in copy mode to be like Vim (hjkl). Get used to the Vi style of using "hjkl" instead of arrow keys. 103 | 104 | Do read [.tmux.conf](https://github.com/akitaonrails/dotfiles/blob/main/dot_tmux.conf.tmpl) from my dotfiles repo. 105 | 106 | ### Did you customize LunarVim? 107 | 108 | LunarVim is mostly stock. I did add a few plugins such as GitHub CoPilot and ChatGPT. 109 | 110 | Do read [config.lua](helpers/config.lua), and go to the bottom of the file to see what I changed. 111 | 112 | ### Why didn't you install virtualenv, nvm or rvm? 113 | 114 | Because the box comes with the much superior [ASDF](https://asdf-vm.com/guide/getting-started.html). 115 | 116 | ### Why did you install the pacman language packages if you installed ASDF? 117 | 118 | The best practice is to have the native packages in the OS do their job. Only configure custom language versions from asdf per project. For example: 119 | 120 | $ cd my_project 121 | $ asdf install ruby 2.6.0 122 | $ asdf local ruby 2.6.0 123 | 124 | Now only this project directory responds to the specific obsolete Ruby 2.6. 125 | 126 | ### Why Chezmoi to manage dotfiles? 127 | 128 | Because it felt simple. You should always edit dotfiles in the `~/.local/share/chezmoi` directory and add information specific to your machine in `~/.config/chezmoi/chezmoi.toml`. 129 | 130 | If you created a new dotfile, add it to the repository: 131 | 132 | $ chezmoi add --autotemplate .fishrc 133 | 134 | If you changed some file in the `local/share` directory, update your real files with: 135 | 136 | $ chezmoi update 137 | 138 | When everything is working, push to your fork of my dotfiles with: 139 | 140 | $ chezmoi cd 141 | $ git add . ; git commit -m "description" ; git push origin main 142 | $ exit 143 | 144 | Read [their documentation](https://www.chezmoi.io/) 145 | 146 | ### What are the largest installed packages? 147 | 148 | This is why I chose not to install Postman (~300MB), Azure-Cli (~600MB), Google Cloud SDK (600MB). You can install them inside the box anyway. But damn, Rust is heavy! 149 | 150 | ``` 151 | ❯ yay -Ps 152 | ==> Yay version v11.3.2 153 | =========================================== 154 | ==> Total installed packages: 558 155 | ==> Foreign installed packages: 10 156 | ==> Explicitly installed packages: 83 157 | ==> Total Size occupied by packages: 4.8 GiB 158 | ==> Size of pacman cache /var/cache/pacman/pkg/: 30.0 MiB 159 | ==> Size of yay cache /home/akitaonrails/.local/share/distrobox/webdevbox/.cache/yay: 0.0 B 160 | =========================================== 161 | ==> Ten biggest packages: 162 | rust: 526.4 MiB 163 | insomnia-bin: 394.9 MiB 164 | jdk11-openjdk: 322.2 MiB 165 | chromium: 277.2 MiB 166 | go: 195.6 MiB 167 | gcc: 171.3 MiB 168 | jre11-openjdk-headless: 159.8 MiB 169 | gcc-libs: 137.8 MiB 170 | llvm-libs: 120.5 MiB 171 | erlang-nox: 105.8 MiB 172 | =========================================== 173 | ``` 174 | 175 | ### I'm receiving errors from Podman or Podman Compose 176 | 177 | If you see errors similar to this: 178 | 179 | `ERRO[0000] running `/usr/sbin/newuidmap 25137 0 1000 1 1 75537 65535`: newuidmap: write to uid_map failed: Operation not permitted` 180 | 181 | Then run this in the terminal: 182 | 183 | $ __webdevbox_podman_config 184 | 185 | The initial welcome script already runs this, but for some reason the error comes back until we run this again. 186 | 187 | Happy Hacking! 188 | 189 | ### Links 190 | 191 | * [Distrobox](https://github.com/89luca89/distrobox) 192 | * [LunarVim](https://github.com/LunarVim/LunarVim) 193 | * [Learn Vim](https://github.com/iggredible/Learn-Vim) 194 | * [Chezmoi](https://www.chezmoi.io/user-guide/command-overview/) 195 | * [RedHat: How to use Podman inside of container](https://www.redhat.com/sysadmin/podman-inside-container) 196 | * [Rootless Podman](https://github.com/containers/podman/blob/main/docs/tutorials/rootless_tutorial.md) 197 | * [vim-tmux-navigator](https://github.com/christoomey/vim-tmux-navigator) 198 | * [ChatGPT in Vim](https://github.com/jackMort/ChatGPT.nvim) 199 | * [Writing Your Tmux Config: a Detailed Guide](https://thevaluable.dev/tmux-config-mouseless/) 200 | * [Useful Tmux Configuration Examples](https://dev.to/iggredible/useful-tmux-configuration-examples-k3g) 201 | * [Awesome Tmux Plugins](https://github.com/rothgar/awesome-tmux#plugins) 202 | * [JAIME'S GUIDE TO TMUX: THE MOST AWESOME TOOL YOU DIDN'T KNOW YOU NEEDED](https://www.barbarianmeetscoding.com/blog/jaimes-guide-to-tmux-the-most-awesome-tool-you-didnt-know-you-needed) 203 | * [Atuin: A Powerful Alternative for Shell History](https://trendoceans.com/atuin-linux/) 204 | 205 | Copyright (C) Fabio Akita - 2023 206 | [MIT LICENSED](LICENSE) 207 | -------------------------------------------------------------------------------- /helpers/add-aur.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # this script takes two arguments and sets up unattended AUR access for user ${1} via a helper, ${2} 3 | set -o pipefail 4 | set -o errexit 5 | set -o nounset 6 | set -o verbose 7 | set -o xtrace 8 | 9 | AUR_USER="${1:-ab}" 10 | HELPER="${2:-yay}" 11 | 12 | # update mirrorlist 13 | #curl --silent --location https://raw.githubusercontent.com/greyltc/docker-archlinux/master/get-new-mirrors.sh > /tmp/get-new-mirrors 14 | #chmod +x /tmp/get-new-mirrors 15 | #mv /tmp/get-new-mirrors /bin/. 16 | #get-new-mirrors 17 | 18 | # we're gonna need sudo to use the helper properly 19 | pacman --sync --needed --noconfirm --noprogressbar sudo || echo "Nothing to do" 20 | 21 | # create the user 22 | AUR_USER_HOME="/var/${AUR_USER}" 23 | useradd "${AUR_USER}" --system --shell /usr/bin/nologin --create-home --home-dir "${AUR_USER_HOME}" 24 | 25 | # lock out the AUR_USER's password 26 | passwd --lock "${AUR_USER}" 27 | 28 | # give the aur user passwordless sudo powers for pacman 29 | echo "${AUR_USER} ALL=(ALL) NOPASSWD: /usr/bin/pacman" > "/etc/sudoers.d/allow_${AUR_USER}_to_pacman" 30 | 31 | # let root cd with sudo 32 | echo "root ALL=(ALL) CWD=* ALL" > /etc/sudoers.d/permissive_root_Chdir_Spec 33 | 34 | # build config setup 35 | sudo -u ${AUR_USER} -D~ bash -c 'mkdir -p .config/pacman' 36 | 37 | # use all possible cores for builds 38 | sudo -u ${AUR_USER} -D~ bash -c 'echo MAKEFLAGS="-j\$(nproc)" > .config/pacman/makepkg.conf' 39 | 40 | # don't compress the packages built here 41 | #sudo -u ${AUR_USER} -D~ bash -c 'echo PKGEXT=".pkg.tar" >> .config/pacman/makepkg.conf' 42 | 43 | # setup storage for AUR packages built 44 | NEW_PKGDEST="/var/cache/makepkg/pkg" 45 | NPDP=$(dirname "${NEW_PKGDEST}") 46 | mkdir -p "${NPDP}" 47 | install -o "${AUR_USER}" -d "${NEW_PKGDEST}" 48 | sudo -u ${AUR_USER} -D~ bash -c "echo \"PKGDEST=${NEW_PKGDEST}\" >> .config/pacman/makepkg.conf" 49 | 50 | # setup place for foreign packages 51 | FOREIGN_PKG="/var/cache/foreign-pkg" 52 | FPP=$(dirname "${FOREIGN_PKG}") 53 | mkdir -p "${FPP}" 54 | install -o "${AUR_USER}" -d "${FOREIGN_PKG}" 55 | 56 | # get helper pkgbuild 57 | sudo -u "${AUR_USER}" -D~ bash -c "curl --silent --location https://aur.archlinux.org/cgit/aur.git/snapshot/${HELPER}.tar.gz | bsdtar -xvf -" 58 | 59 | # make helper 60 | sudo -u "${AUR_USER}" -D~//${HELPER} bash -c "makepkg -s --noprogressbar --noconfirm --needed" 61 | 62 | # install helper 63 | pacman --upgrade --needed --noconfirm --noprogressbar "${NEW_PKGDEST}"/*.pkg.* 64 | 65 | # cleanup 66 | sudo rm -rf "${NEW_PKGDEST}"/* 67 | rm -rf "${AUR_USER_HOME}/${HELPER}" 68 | rm -rf "${AUR_USER_HOME}/.cache/go-build" 69 | rm -rf "${AUR_USER_HOME}/.cargo" 70 | 71 | # chuck deps 72 | pacman -Rns --noconfirm $(pacman -Qtdq) || echo "Nothing to remove" 73 | 74 | tee /bin/aur-install </dev/null 2>&1" || : 95 | else 96 | DELETE_OPT="" 97 | fi 98 | sudo -u "${AUR_USER}" -D~ bash -c "yes | ${HELPER} --sync -cc\${DELETE_OPT} >/dev/null 2>&1" 99 | sudo rm -rf "${NEW_PKGDEST}"/* 100 | EOF 101 | chmod +x /bin/aur-install 102 | 103 | if test "${HELPER}" = yay || test "${HELPER}" = paru 104 | then 105 | /bin/aur-install ${HELPER} 106 | 107 | echo "Packages from the AUR can now be installed like this:" 108 | echo "aur-install package-number-one package-number-two" 109 | fi 110 | -------------------------------------------------------------------------------- /helpers/config.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | lvim is the global options object 3 | 4 | Linters should be 5 | filled in as strings with either 6 | a global executable or a path to 7 | an executable 8 | ]] 9 | -- THESE ARE EXAMPLE CONFIGS FEEL FREE TO CHANGE TO WHATEVER YOU WANT 10 | 11 | -- general 12 | lvim.log.level = "warn" 13 | lvim.format_on_save.enabled = false 14 | lvim.colorscheme = "lunar" 15 | -- to disable icons and use a minimalist setup, uncomment the following 16 | -- lvim.use_icons = false 17 | 18 | -- keymappings [view all the defaults by pressing Lk] 19 | lvim.leader = "space" 20 | -- add your own keymapping 21 | lvim.keys.normal_mode[""] = ":w" 22 | -- lvim.keys.normal_mode[""] = ":BufferLineCycleNext" 23 | -- lvim.keys.normal_mode[""] = ":BufferLineCyclePrev" 24 | -- unmap a default keymapping 25 | -- vim.keymap.del("n", "") 26 | -- override a default keymapping 27 | -- lvim.keys.normal_mode[""] = ":q" -- or vim.keymap.set("n", "", ":q" ) 28 | 29 | -- Change Telescope navigation to use j and k for navigation and n and p for history in both input and normal mode. 30 | -- we use protected-mode (pcall) just in case the plugin wasn't loaded yet. 31 | -- local _, actions = pcall(require, "telescope.actions") 32 | -- lvim.builtin.telescope.defaults.mappings = { 33 | -- -- for input mode 34 | -- i = { 35 | -- [""] = actions.move_selection_next, 36 | -- [""] = actions.move_selection_previous, 37 | -- [""] = actions.cycle_history_next, 38 | -- [""] = actions.cycle_history_prev, 39 | -- }, 40 | -- -- for normal mode 41 | -- n = { 42 | -- [""] = actions.move_selection_next, 43 | -- [""] = actions.move_selection_previous, 44 | -- }, 45 | -- } 46 | 47 | -- Change theme settings 48 | -- lvim.builtin.theme.options.dim_inactive = true 49 | -- lvim.builtin.theme.options.style = "storm" 50 | 51 | -- Use which-key to add extra bindings with the leader-key prefix 52 | -- lvim.builtin.which_key.mappings["P"] = { "Telescope projects", "Projects" } 53 | -- lvim.builtin.which_key.mappings["t"] = { 54 | -- name = "+Trouble", 55 | -- r = { "Trouble lsp_references", "References" }, 56 | -- f = { "Trouble lsp_definitions", "Definitions" }, 57 | -- d = { "Trouble document_diagnostics", "Diagnostics" }, 58 | -- q = { "Trouble quickfix", "QuickFix" }, 59 | -- l = { "Trouble loclist", "LocationList" }, 60 | -- w = { "Trouble workspace_diagnostics", "Workspace Diagnostics" }, 61 | -- } 62 | 63 | -- TODO: User Config for predefined plugins 64 | -- After changing plugin config exit and reopen LunarVim, Run :PackerInstall :PackerCompile 65 | lvim.builtin.alpha.active = true 66 | lvim.builtin.alpha.mode = "dashboard" 67 | lvim.builtin.terminal.active = true 68 | lvim.builtin.nvimtree.setup.view.side = "left" 69 | lvim.builtin.nvimtree.setup.renderer.icons.show.git = false 70 | 71 | -- if you don't want all the parsers change this to a table of the ones you want 72 | lvim.builtin.treesitter.ensure_installed = { 73 | "bash", 74 | "c", 75 | "javascript", 76 | "json", 77 | "lua", 78 | "python", 79 | "typescript", 80 | "tsx", 81 | "css", 82 | "rust", 83 | "java", 84 | "yaml", 85 | "elixir", 86 | "ruby", 87 | "eex", 88 | } 89 | 90 | lvim.builtin.treesitter.ignore_install = { "haskell" } 91 | lvim.builtin.treesitter.highlight.enable = true 92 | 93 | -- generic LSP settings 94 | 95 | -- -- make sure server will always be installed even if the server is in skipped_servers list 96 | -- lvim.lsp.installer.setup.ensure_installed = { 97 | -- "sumneko_lua", 98 | -- "jsonls", 99 | -- } 100 | -- -- change UI setting of `LspInstallInfo` 101 | -- -- see 102 | -- lvim.lsp.installer.setup.ui.check_outdated_servers_on_open = false 103 | -- lvim.lsp.installer.setup.ui.border = "rounded" 104 | -- lvim.lsp.installer.setup.ui.keymaps = { 105 | -- uninstall_server = "d", 106 | -- toggle_server_expand = "o", 107 | -- } 108 | 109 | -- ---@usage disable automatic installation of servers 110 | -- lvim.lsp.installer.setup.automatic_installation = false 111 | 112 | -- ---configure a server manually. !!Requires `:LvimCacheReset` to take effect!! 113 | -- ---see the full default list `:lua print(vim.inspect(lvim.lsp.automatic_configuration.skipped_servers))` 114 | -- vim.list_extend(lvim.lsp.automatic_configuration.skipped_servers, { "pyright" }) 115 | -- local opts = {} -- check the lspconfig documentation for a list of all possible options 116 | -- require("lvim.lsp.manager").setup("pyright", opts) 117 | 118 | -- ---remove a server from the skipped list, e.g. eslint, or emmet_ls. !!Requires `:LvimCacheReset` to take effect!! 119 | -- ---`:LvimInfo` lists which server(s) are skipped for the current filetype 120 | -- lvim.lsp.automatic_configuration.skipped_servers = vim.tbl_filter(function(server) 121 | -- return server ~= "emmet_ls" 122 | -- end, lvim.lsp.automatic_configuration.skipped_servers) 123 | 124 | -- -- you can set a custom on_attach function that will be used for all the language servers 125 | -- -- See 126 | -- lvim.lsp.on_attach_callback = function(client, bufnr) 127 | -- local function buf_set_option(...) 128 | -- vim.api.nvim_buf_set_option(bufnr, ...) 129 | -- end 130 | -- --Enable completion triggered by 131 | -- buf_set_option("omnifunc", "v:lua.vim.lsp.omnifunc") 132 | -- end 133 | 134 | -- -- set a formatter, this will override the language server formatting capabilities (if it exists) 135 | -- local formatters = require "lvim.lsp.null-ls.formatters" 136 | -- formatters.setup { 137 | -- { command = "black", filetypes = { "python" } }, 138 | -- { command = "isort", filetypes = { "python" } }, 139 | -- { 140 | -- -- each formatter accepts a list of options identical to https://github.com/jose-elias-alvarez/null-ls.nvim/blob/main/doc/BUILTINS.md#Configuration 141 | -- command = "prettier", 142 | -- ---@usage arguments to pass to the formatter 143 | -- -- these cannot contain whitespaces, options such as `--line-width 80` become either `{'--line-width', '80'}` or `{'--line-width=80'}` 144 | -- extra_args = { "--print-with", "100" }, 145 | -- ---@usage specify which filetypes to enable. By default a providers will attach to all the filetypes it supports. 146 | -- filetypes = { "typescript", "typescriptreact" }, 147 | -- }, 148 | -- } 149 | 150 | -- -- set additional linters 151 | -- local linters = require "lvim.lsp.null-ls.linters" 152 | -- linters.setup { 153 | -- { command = "flake8", filetypes = { "python" } }, 154 | -- { 155 | -- -- each linter accepts a list of options identical to https://github.com/jose-elias-alvarez/null-ls.nvim/blob/main/doc/BUILTINS.md#Configuration 156 | -- command = "shellcheck", 157 | -- ---@usage arguments to pass to the formatter 158 | -- -- these cannot contain whitespaces, options such as `--line-width 80` become either `{'--line-width', '80'}` or `{'--line-width=80'}` 159 | -- extra_args = { "--severity", "warning" }, 160 | -- }, 161 | -- { 162 | -- command = "codespell", 163 | -- ---@usage specify which filetypes to enable. By default a providers will attach to all the filetypes it supports. 164 | -- filetypes = { "javascript", "python" }, 165 | -- }, 166 | -- } 167 | 168 | -- Additional Plugins 169 | -- lvim.plugins = { 170 | -- { 171 | -- "folke/trouble.nvim", 172 | -- cmd = "TroubleToggle", 173 | -- }, 174 | -- } 175 | lvim.plugins = { 176 | { "zbirenbaum/copilot.lua", 177 | event = { "VimEnter" }, 178 | config = function() 179 | vim.defer_fn(function() 180 | require("copilot").setup { 181 | plugin_manager_path = get_runtime_dir() .. "/site/pack/packer", 182 | panel = { auto_refresh = true }, 183 | suggestion = { auto_trigger = true }, 184 | } 185 | end, 100) 186 | end, 187 | }, 188 | { "zbirenbaum/copilot-cmp", 189 | after = { "copilot.lua", "nvim-cmp" }, 190 | }, 191 | { "machakann/vim-sandwich" }, 192 | { "christoomey/vim-tmux-navigator" }, 193 | { "jackMort/ChatGPT.nvim", 194 | event = { "VimEnter" }, 195 | requires = { 196 | "MunifTanjim/nui.nvim", 197 | "nvim-lua/plenary.nvim", 198 | "nvim-telescope/telescope.nvim" 199 | }, 200 | config = function() 201 | vim.defer_fn(function() 202 | if(vim.env.OPENAI_API_KEY) then 203 | require("chatgpt").setup { 204 | } 205 | end 206 | end, 100) 207 | end, 208 | }, 209 | ... 210 | } 211 | 212 | -- Can not be placed into the config method of the plugins. 213 | lvim.builtin.cmp.formatting.source_names["copilot"] = "(Copilot)" 214 | table.insert(lvim.builtin.cmp.sources, 1, { name = "copilot" }) 215 | 216 | -- Autocommands (https://neovim.io/doc/user/autocmd.html) 217 | -- vim.api.nvim_create_autocmd("BufEnter", { 218 | -- pattern = { "*.json", "*.jsonc" }, 219 | -- -- enable wrap mode for json files only 220 | -- command = "setlocal wrap", 221 | -- }) 222 | -- vim.api.nvim_create_autocmd("FileType", { 223 | -- pattern = "zsh", 224 | -- callback = function() 225 | -- -- let treesitter use bash highlight for zsh files as well 226 | -- require("nvim-treesitter.highlight").attach(0, "bash") 227 | -- end, 228 | -- }) 229 | -------------------------------------------------------------------------------- /helpers/containers.conf: -------------------------------------------------------------------------------- 1 | [containers] 2 | netns="host" 3 | userns="host" 4 | ipcns="host" 5 | utsns="host" 6 | cgroupns="host" 7 | cgroups="disabled" 8 | log_driver = "k8s-file" 9 | [engine] 10 | cgroup_manager = "cgroupfs" 11 | events_logger="file" 12 | runtime="crun" 13 | -------------------------------------------------------------------------------- /helpers/initial_setup.zsh: -------------------------------------------------------------------------------- 1 | source $HOME/.config/zsh/webdevbox.zsh 2 | 3 | if [ -f /var/tmp/first-time.lock ]; then 4 | sudo chown -R $UID:$GID $HOME/.config 5 | sudo chown -R $UID:$GID $HOME/.local 6 | sudo chown -R $UID:$GID $HOME/.asdf 7 | __webdevbox_podman_config 8 | 9 | echo "Welcome to webDevBox" 10 | __webdevbox_welcome 11 | __webdevbox_instructions 12 | 13 | sudo rm /var/tmp/first-time.lock # remove first time flag 14 | mv $HOME/.zshrc /tmp # expect chezmoi to create a new one 15 | cd $HOME 16 | fi 17 | -------------------------------------------------------------------------------- /helpers/intro.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akitaonrails/webdevbox/a872371972e0f3b3fa2cdd285d67c3ebca892efb/helpers/intro.png -------------------------------------------------------------------------------- /helpers/podman-containers.conf: -------------------------------------------------------------------------------- 1 | [containers] 2 | volumes = [ 3 | "/proc:/proc", 4 | ] 5 | default_sysctls = [] 6 | -------------------------------------------------------------------------------- /helpers/webdevbox.zsh: -------------------------------------------------------------------------------- 1 | __webdevbox_welcome() { 2 | echo ' __ _ __ ____\_ |__ __| _/_______ _\_ |__ _______ ___' 3 | echo ' \ \/ \/ // __ \| __ \ / __ |/ __ \ \/ /| __ \ / _ \ \/ /' 4 | echo ' \ /\ ___/| \_\ \/ /_/ \ ___/\ / | \_\ ( <_> > < ' 5 | echo ' \/\_/ \___ >___ /\____ |\___ >\_/ |___ /\____/__/\_ \' 6 | echo ' \/ \/ \/ \/ \/ \/' 7 | echo '61 6B 69 74 61 6F 6E 72 61 69 6C 73 40 43 6F 64 65 4D 69 6E 65 72 34 32' 8 | } 9 | 10 | __webdevbox_instructions() { 11 | echo "" 12 | echo "Run 'chezmoi init ' to initialize your dotfiles." 13 | echo "Atuin is enabled, register with atuin register; atuin import auto; atuin sync. Ctrl+r opens the search." 14 | echo "If you're using an isolated home folder, don't forget to symlink your ~/.ssh." 15 | echo "Open Tmux and install the plugins with Ctrl+B and Shift+I, then Ctrl+b and r to reload." 16 | echo "" 17 | } 18 | 19 | __webdevbox_podman_config() { 20 | # not sure why, but I have to run this lower setting first 21 | sudo su -c "echo podman:10000:10000 > /etc/subuid" 22 | sudo su -c "echo podman:10000:10000 > /etc/subgid" 23 | sudo sh -c "echo $USER:20001:10000 >> /etc/subuid" 24 | sudo sh -c "echo $USER:20001:10000 >> /etc/subgid" 25 | podman info > /dev/null 26 | 27 | # only now I can increate it 28 | sudo su -c "echo podman:10000:65535 > /etc/subuid" 29 | sudo su -c "echo podman:10000:65535 > /etc/subgid" 30 | sudo sh -c "echo $USER:75537:65535 >> /etc/subuid" 31 | sudo sh -c "echo $USER:75537:65535 >> /etc/subgid" 32 | } 33 | --------------------------------------------------------------------------------