The main goal of this project is to help developers to focus on delivering value instead of struggling with the workstation configuration.
The solution provided is a composed of :
- one-liner installer script that will fully configure a workstation for mobile and web development.
- a cli tool named "laptop" to help workstation maintenance event after the script was installed
- an extended bash function collection to be able to create other configuration profile than the one on this repository
Its core values are :
- 🤖 Automated : provide all required tools with almost no manual action
- ✅ Safe : multiple runs should always work
- 🧑🏫 Opinionated yet Customizable : some configurations might not suit everybody, but for most people it will provide a great working experience. When possible, provide a simple way to customize/override setup
Available profiles :
-
Open a terminal ( How to )
-
Install
laptopexecutable and custom.zshrc:/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/jpolo/laptop/main/install.sh)" -
Install all programs :
laptop setup
Platform supported :
- ✓ macOS
- ✓ Debian like distros (Ubuntu, Debian)
- devcontainers (i.e. Docker) supported
Package Manager supported :
The laptop ZSH plugin provides a laptop executable. This executable was created to make easier the maintenance of your laptop by providing a simple way to :
- update all tools and dependencies, to avoid security issues and benefit from latest bug fixes
- remove all unneeded files and free disk space
- auto-update itself. laptop can be updated itself to benefit to the latest tools / configuration of the organization
Shell completions are also provided for Bash and Zsh. When installed with make install (including from a Homebrew formula), completion files are installed under share/bash-completion/completions and share/zsh/site-functions.
- Built to be easily forked (better for security, so everyone can review the code)
- Many bash functions for your needs in
./src/functions - Multiple configuration profile is possible
laptop aims to give a common full feature basis for each laptop machine.
Although there are some implementation tradeoffs, it should never limit developers to customize their workstation.
🔧 Override/Customize ZSH configuration
.zshrc because any changes will be lost when laptop script is run.
Here is the order of profile loading :
-
🔒
~/.zprofile(managed by laptop)- 🔒
~/.profile(managed by laptop) - ✍️
$XDG_CONFIG_HOME/zsh/profile: user settings - ✍️
$XDG_DATA_HOME/zsh/profile: local machine settings
- 🔒
-
🔒
~/.zshrc(managed by laptop)- ✍️
$XDG_CONFIG_HOME/zsh/init.d/*: user settings as directory - ✍️
$XDG_CONFIG_HOME/zsh/init: user settings as file - ✍️
$XDG_DATA_HOME/zsh/init.d/*: local machine settings as directory - ✍️
$XDG_DATA_HOME/zsh/init: local machine settings as file - ✍️
.zshrc.local: local machine settings (alternate solution)
- ✍️
Plugin modules are managed separately in $ZIM_CONFIG_FILE (by default, $XDG_CONFIG_HOME/zim/zimrc). Add modules there with zimfw's zmodule command. The default file is created if missing and is not overwritten on later setup runs.
Existing custom zinit declarations are not converted automatically. Move and manually convert those declarations to zimfw syntax in zimrc; the old zinit cache is left untouched.
Zimfw initializes modules in zimrc order through a generated startup script; zinit's wait-based deferred loading is not carried over.
Example $ZIM_CONFIG_FILE :
# Load Oh-My-Zsh ruby and rails plugins
zmodule ohmyzsh/ohmyzsh --root plugins/ruby
zmodule ohmyzsh/ohmyzsh --root plugins/rails🎨 Customize ZSH Theme
> code $STARSHIP_CONFIG- Fork this repository
- Copy
profile/default/profile.shtoprofile/{{my-company-profile}}/profile.sh - Customize
profile/{{my-company-profile}}(Avoid changingprofile/default)- Modify
profile/{{my-company-profile}}/profile.shto fit your needs - Put any resources / template in this folder
- Modify
- Customize the installer script
install.sh - Update the
README.mdinstallation instructions
Laptop CLI has subcommands for setup, upgrades, cleanup, and maintenance status.
More information is available with the command laptop help.
Try to install all software from the current profile (that was configured at first installation).
Detect many tools (brew, asdf, etc) and launch their respective update command.
For zimfw, this updates installed modules and upgrades the zimfw manager itself. If zinit is detected instead, it runs zinit update --all.
This will also update the laptop plugin and executable itself.
Launch this command regularly to be up to date and avoid keeping old software with potential security vulnerabilities.
Upgrade only the laptop CLI to the latest version. Use this when you are notified that a new version is available, or when you want to update the CLI without upgrading other tools. When laptop is installed via Homebrew, this runs brew upgrade for the laptop formula.
Display the current laptop version, the latest available version, and overall update status (up-to-date or outdated). Also reports the installation method, active profile, and available disk space.
Run this to quickly verify that your laptop installation is healthy and up to date.
Detect many tools (brew, asdf, etc) and try to free disk space (in a "safe" manner) :
- Remove cache
- Prune unused data
For zimfw, this runs zimfw clean to remove compiled files and the completion dumpfile. It does not uninstall modules. If zinit is detected instead, it runs zinit cclear and zinit delete --clean.
NPM, docker, mobile development can be quite greedy on disk space. Launch this command regularly to avoid to be out of free disk space.
Display the laptop logo and maintenance status for setup, upgrade, and cleanup.
setup is warned only when the current laptop profile version has not been launched. The grace period starts the first time that version is seen. upgrade and cleanup warn when their last completion interval has passed. A warning is also shown when host uptime reaches the configured threshold, recommending a reboot.
The warning intervals can be customized with LAPTOP_SETUP_DELAY, LAPTOP_UPGRADE_DELAY, LAPTOP_CLEANUP_DELAY, and LAPTOP_UPTIME_DELAY. When unset, the corresponding self configuration keys setup_delay, upgrade_delay, cleanup_delay, and uptime_delay are used. Defaults are 2, 7, 30, and 30 days.
Original repository is hosted at https://github.com/jpolo
Contributions are welcome especially when :
- adding documentation to the laptop shell library
./src/functions - adding new capabilities / support for the tool
- reporting / fixing security issues
If you like this repository and it made you win a lot of time / money (by not hiring a devops for example :) ), you may consider a small donation to help me maintaining this repository Link to my profile.