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 - if on mac,
homebrew, and if on Arch,yay - If on mac, XCode command line tools (can't even build
gccfromhomebrewwithout this):sudo xcode-select --install - make a directory called
~/dotfiles/with all of your dotfiles. I personally have a private githubdotfilesrepo. I simply clone that to use this. - Write
config.json; see the next section
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~/dotfilesdirectory, that can vary by "location" if you want. IE, if you have a.gitconfigthat 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 genericallkey 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! If the command needs sudo, it will pause and ask for your sudo password using aSTDINpipe, so privileged commands are fine.packages: a list of packages to install, which can be specified as os-agnostic, or by OS type. You can also include "agnostic" installs in the os-specific sections, for example, "I only want this NPM package installed on my mac".
Supported package managers:
brew/brew_tap: macOS Homebrew packages and tapspacman/yay: Arch Linux packagesppa/apt/snap: Ubuntu PPAs, apt packages, and snap packagesnpm: Node.js packages (cross-platform)go_install: Go packages viago install(cross-platform)cargo: Rust packages viacargo install(cross-platform)fisher: Fish shell plugins (cross-platform)
Note: For Ubuntu, ppa entries are automatically processed before apt regardless of order in the config.
prereq_packages: packages that provide language toolchains (rust/cargo, go, poetry) needed before other packages can be installed. These are installed beforepackages. Structure is the same aspackagesbut keyed by OS only (noallsection).
You can create separate config files for work vs private environments:
~/dotfiles/bootstrap_config.json- main config (always loaded)~/dotfiles/bootstrap_config_work.json- loaded when--loctype work~/dotfiles/bootstrap_config_private.json- loaded when--loctype private
The extra config files are optional and use the same schema. They're processed after the main config, so you can put environment-specific packages (like kubernetes tools for work) in separate files.
- You must have
homebrewinstalled on mac, andyayinstalled on Arch linux. - You must have
~/dotfiles/directory with your dotfiles in it. - You must have
config.jsonfile written. - You must have
python3andpoetryinstalled.
poetry install
poetry run runboot [args]
You can also set CMD args on the command line:
poetry run runboot --systype mac --loctype work
poetry run runboot --systype arch --loctype private
poetry run runboot --systype ubuntu --loctype work
The script is idempotent - it is safe to run repeatedly. You can add packages to config.json and re-run.
- User supplied functions