Skip to content

Laptop is a script to set up a computer for development.

License

Notifications You must be signed in to change notification settings

ssmereka/laptop

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Laptop

Laptop is a script to set up your computer for software development.

It's idempotent and installs, upgrades, or skips packages based on what is already installed on the machine. In otherwords, there's no downside to running it again and again.

It supports macOS on Apple Silicon and Intel processors.

Inspired by Thoughtbot's Laptop, and I hope this inspires you too!

Getting Started

Setup your Secrets

A few secrets are required to get setup. Laptop is configured to retreive these secrets from 1Password. So you're going to need 1Password for this to work out of the box.

  1. Download, install, and login to the 1Password MacOS application.

  2. Create a GitHub Personal Access Token.

  3. Unlock 1Password and add a Login item called GitHub with at least the following fields:

    Type Label Example Value Description
    text name John Smith Full name to be used in Git configuration
    text email [email protected] Personal email address to be used in Git configuration
    password token github_pat_asdfjkl GitHub Personal Access Token to be used with GitHub CLI
    text username jsmith GitHub username
  4. Generate and save a new SSH Key in 1Password with the name GitHub SSH Key.

  5. Create a Authentication SSH Key in GitHub with the public portion of the SSH Key you just added to 1Password.

  6. Create a Signing SSH Key in GitHub with the public portion of the SSH Key you just added to 1Password.

  7. Enable 1Password App Integration so you can use the 1Password CLI. Check at least the following:

    • ✅ Use the SSH Agent
    • ✅ Integrate with 1Password CLI

Install Laptop

  1. Review the mac script. Avoid running a script you haven't read!

  2. Run the mac script.

    curl -o- https://raw.githubusercontent.com/ssmereka/laptop/main/src/mac | zsh

This will clone the git project to ~/code/laptop and setup your computer!

Using Laptop

Laptop installs software and configures your Laptop. It also provides some useful commands. Run the command help in your terminal for a list of available commands. (You may need to relaunch your terminal if the command doesn't work)

laptop-help

Update Laptop

Want the latest updates? Just re-run the mac script again:

curl -o- https://raw.githubusercontent.com/ssmereka/laptop/main/src/mac | zsh

Optionally, use the Laptop alias:

lt-update

What does Laptop do?

Laptop installs and configures the following software:

Laptop will configure your computer in a very opinionated way. Let's describe those opinions and how the script is configured to meet them.

ZSH Configuration

Terminal history should persist indefinitely as evidence of the actions you have taken.

Your history is a timeline of actions you have taken that can be leveraged for a number of use-caes. Like recalling what you did to setup an application. Or reviewing actions taken during an outage.

The zsh history is configured to store all (well... 999,999,999) events in the terminal and the ~/.zsh_history file. With each event containing a timestamp (in seconds since the epoch) and duration (in seconds) of the command. The history is shared across all terminal sessions, as if they were a single session.

If you need to enter secret information into your terminal prefix the command with a space, like " SECRET=my-password". Any command the begins with a space will not be stored in the history.

Use Atuin (using the Up Arrow or CTRL+R) to interactively view and search your history. Programmatically search with the history command, like history | grep <search term here>.

ASDF Version Manager

When developing you want your development environment to be as close to production as is reasonable. Switching between mutliple versions of software is complicated. To make switching easier, use version managers and package managers.

Homebrew, mac's unofficial package manager, is installed and used to manage the installation of 3rd party software, like 1password and curl.

Language version managers are installed for Node.js, Python, Go, and Ruby. Enabling you to quickly install and use different versions for each application you are developing. These version manager are all managed by asdf. This makes interaction with version managers more consistant as you switch between them or need to add/remove version managers.

Code Directory

Coding projects from git repositories are stored in the local ~/code directory. This make it easy to find git projects.

Secrets

Secrets belong in a password manager or secret storage and you should authorize when anything tries to access those secrets. Laptop will install and configure the 1Password CLI so that secrets can be retrieved programmatically. Git is also configured to use 1Password for authentication and signing.

Customize Laptop

You can customize Laptop for each computer by placing files in the ~/.laptop directory. If provided, the following files will be used:

  • .custom_install.sh - Script that will be run at the end of the Laptop install.

Here's a .custom_install.sh example:

#!/bin/zsh

brew bundle --file=- <<EOF
brew "ngrok"
EOF

Write your customizations such that they can be run safely more than once.

About

Laptop is a script to set up a computer for development.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages