This "package" allows you to specify a complete dev env setup, including packages to install (homebrew, yay, pacman, npm, etc etc).
You write a config.json
, then run a python CLI tool.
I use this to keep multiple machines (work mac, home Arch, Docker based arch dev boxes) all up to date with my dev environment.
There are probably many. However, the well known ones; Puppet, Chef, Ansible, etc, are very heavyweight for my needs.
There are a lot of "dotfiles" repos on github; this depends on that --- it requires you to have a ~/dotfiles/
repo that can be symlinked against, but it goes a lot further (than dotfiles).
This was only a few hundred lines of python, and I've been using this to setup new computers (eg new Macs, new PC builds) and Dockerized development environments for years.
I am planning on making this more extensible so the user can provide functions that get run.
- python3 (I am using 3.11) and
poetry
andpyenv
(curl https://pyenv.run | bash
) - if on mac,
homebrew
, and if on Arch,yay
- If on mac, XCode command line tools (can't even build
gcc
fromhomebrew
without this):sudo xcode-select --install
- make a directory called
~/dotfiles/
with all of your dotfiles. I personally have a private githubdotfiles
repo. I simply clone that to use this. - Write
config.json
; see the next section
Optional:
- if you want
vim
installed, your.vimrc
should be using vim-plug.
To use this package, you write a config.json
to describe what you would like linked, installed, ran, etc.
That is the only input, other than a few cmd line parameters.
A sample (actually a copy of my real one!) config is included; see sample_config.json
My personal config.json
is in my private dotfiles
repo, and I clone it in step 4 above.
Please see the (evolving) jsonschema for config.json
in bootstrap/schema.py
for the full schema.
These are the major sections:
comments
: this is a list of strings for your own sanity, since JSON has no native commenting mechanism.initial_mkdirs
: directories to be recursively made. For example,~/.ssh/..
. You can specify whether to try deleting the directory first, which is helpful for "rebootstrapping"links
: this is a list of softlinked dotfiles, from you~/dotfiles
directory, that can vary by "location" if you want. IE, if you have a.gitconfig
that you use on "work" machines, and a seperate one you use on "private" machines, you can specify these seperately, and when you run the script, you specify the location. There is also a genericall
key for specifying location-agnostic keys.commands
: a list of arbitrary commands to run, which can be specified as os-agnostic, or by OS type. Warning, whatever you put here will be executed!. While I havent tested this on mac yet, on linux, if the command needs sudo, it will pause and ask for your sudo password using aSTDIN
pipe, so privleged commands are fine.packages
: a list of packages to install, which can be specified as os-agnostic, or by OS type. Examples of agnostic installs includenpm
andpip
. Examples ofmac
includebrew
. You can also include "agnostic" installs in the os-specific sections, for example, "I only want this NPM package installed on my mac".
poetry install
poetry run runboot [args]
You can also set CMD args on the command line:
poetry run runboot --prereqs t --name tommycarpenter --redovim n --systype mac --loctype work
poetry run runboot --prereqs t --name tommy --redovim n --systype arch --loctype private
/home/ubuntu/.local/bin/poetry run runboot --prereqs t --name ubuntu --redovim y --systype ubuntu --loctype work
It is normally safe to run this repeatedly in an additive manner; as in, you can add packages to config.json
and re-run.
- User supplied functions, and
vim()
should move to this