This project controls my desktop and laptop configurations, including software installation. It takes @holman/dotfiles’s topic based approach to grouping configurations a step further by allowing for installation and uninstallation per grouping, which I call modules.
Do not run this program without modification. I am working to generalize this so it becomes portable to others, but for now, please use it as a starting point or for ideas.
Notably, you should review any Brewfile files and comment out any lines for software you do not want installed upon installing the module.
Also, you can create these two Zsh configuration files to contain any personal settings, aliases, functions, etc.:
This project contains functions and scripts that might be useful outside the project itself.
You can install this program anywhere, but many similar projects use ~/.dotfiles.
If you install it somewhere else, define DOTFILES=/path/to/dotfiles in mods-available/zsh/zshenv.local.symlink.
git clone https://github.com/CNG/dotfiles.git ~/.dotfiles
~/.dotfiles/dotfiles install
If you later move the directory, you should run dotfiles install --force to update any symbolic links set up by installed modules.
Installable modules are simply folders in mods-available that contain any number of files outlined below.
Each module's files can be customized, and new modules can be created simply by creating a directory.
Modules are not actually installed until the dotfiles install module_name command is run.
manifest*Files starting withmanifestlist dependencies for Homebrew Bundle to install and keep updated if possible.install*.[ba]shFiles starting withinstalland ending with.bashor.share run by thedotfiles installcommand. These should contain actions to be performed only once, upon initial module installation, but they may be run again by subsequentdotfiles install --forcecommands.upgrade*.[ba]shFiles starting withupgradeand ending with.bashor.share run by thedotfiles installcommand and thedotfiles upgradecommand. These should contain actions to be performed periodically to keep any components outside the package manifest up to date. Since thedotfiles installcommand also runs the update scripts, actions do not need to be duplicated in both scripts for the sake of having them run on initial install.remove*.[ba]shFiles starting withremoveand ending with.bashor.share run by thedotfiles removecommand. These should undo the corresponding install scripts so the system is left as if the module had never been installed.env*.zshFiles starting withenvand ending with.zshare loaded into the environment first and are expected to set up environment variables like$PATHor custom ones and set up anything needed in cron jobs.plugins*.zshFiles starting withpluginsand ending with.zshare loaded into the interactive shell (which loads after the environment) first and are expected to specify Oh-My-Zsh plugins. Format:plugins=(${plugins:-} brew)completion*.zshFiles starting withcompletionand ending with.zshare loaded into the interactive shell (which loads after the environment) last and are expected to setup autocomplete.*.zshAny other files ending in.zshare loaded into the interactive shell after plugins and before completions. These might include shell configuration and aliases.*.symlinkFiles ending in.symlinkget referenced from symbolic links created in your$HOMEdirectory such that~/.filenameis a symbolic link pointing tofilename.symlink. This allows your system configuration files to automatically reflect updates to this dotfiles project. Links are created by thedotfiles installcommand. If new.symlinkfiles are created after a module is already installed, run thedotfiles install --forcecommand.functions/*Any appropriately formatted files in a folder calledfunctionsare loaded into$fpathand become functions accessible anywhere, similar to aliases. The folder also can contain#compdefcompletion files that usually start with_.
-
dotfiles installInstall the required module, base.dotfiles install AInstall a module.dotfiles install A B C ...Install multiple modules.dotfiles install --allInstall all available modules. Modules following--forcewill be reinstalled. -
dotfiles upgradeUpgrade all installed modules.dotfiles upgrade AUpgrade a module.dotfiles upgrade A B C ...Upgrade multiple modules. -
dotfiles remove ARemove a module.dotfiles remove A B C ...Remove multiple modules.dotfiles remove --allRemove all available modules. Modules following--forcewill be removed again. -
dotfiles cleanupUninstall any installedbrewpackages that are not required by currently installed modules. This does not run any module scripts or modify symbolic links but only analyzes the required package manifests in each installed module and removes any extras that were installed manually or by a module that has since changed. -
dotfiles listList modules installed and available but not installed.dotfiles list --installedList modules installed.dotfiles list --availableList all modules.dotfiles list --not-installedList modules available but not installed. -
dotfiles testsRun nonexhaustive internal tests. -
dotfiles helpDisplay the help page.
I do not yet have a totally sensible split between the modules zsh, base, macos and developer.
@holman/dotfiles had a bin folder that got linked in $PATH and thus allowed for scripts written in any language. I moved most of that to the functions folders for Zsh autoloading, but now I think that only supports scripts written in shell. Modules can update the $PATH to include anything, so I won't worry about it for now.