DEV Community

Sumama Jamil
Sumama Jamil

Posted on

I Spent a Year Setting Up New Machines. So I Built a Tool That Does It in One Command.

Every time I get a new laptop, the same thing happens. Day one. Fresh install. Nothing works the way I want it. No git. No Docker. No Node. No Vim config. Nothing. So I spend the next three hours Googling. "How to install Docker on Ubuntu." "How to set up WSL2 on Windows." "Why is my pacman command not found." Copy, paste, hope. Break something. Start over.

By the end of the day I have a machine that sort of works, but I'm not sure what I installed or whether any of it is set up right. And I know I'll go through the exact same thing next time. If you've ever set up a new machine, you know this feeling. It's not hard. It's just tedious, repetitive, and easy to get wrong.

I got tired of it. So I built "nexus-engine"(https://github.com/Sumama-Jameel/nexus-engine).

What It Does

You write a simple file that describes what you want on your machine. Then you run one command and it sets everything up.

That's it.

Here is what a setup file looks like:

name: my-setup
packages:
  - name: git
    category: foundation
  - name: curl
    category: foundation
  - name: docker
    category: tool
  - name: nodejs
    category: language
Enter fullscreen mode Exit fullscreen mode

Run this:

nexus init
Enter fullscreen mode Exit fullscreen mode

And it does the rest. Detects your OS, figures out which package manager to use, installs everything in the right order, and gives you a report when it's done.

It Works The Same Everywhere

This was the big one for me. I switch between Ubuntu, Arch, and Fedora depending on what I'm doing. Every distro has its own package manager. Different commands, different syntax, different package names.

nexus-engine handles all four major Linux package managers through one interface:

  • apt (Ubuntu, Debian)
  • pacman (Arch, Manjaro)
  • dnf (Fedora, RHEL)
  • apk (Alpine)

You write your setup file once. It works everywhere. You don't need to know which command belongs to which distro.

Windows Gets Linux in About a Minute

If you're on Windows and you want a Linux environment, normally you have to:

  1. Enable WSL
  2. Pick a distro
  3. Download it
  4. Import it
  5. Configure wsl.conf
  6. Set up your packages inside it

That's a lot of steps and a lot of places to go wrong.

With nexus-engine:

nexus wsl setup
Enter fullscreen mode Exit fullscreen mode

It checks if your system is ready, downloads a Linux rootfs, imports it into WSL2, configures it with secure defaults, and you're in. About sixty seconds.

Then you can drop into your Linux environment anytime:

nexus wsl enter
Enter fullscreen mode Exit fullscreen mode

If Something Breaks, It Cleans Up

This is the part that always got me with manual setup. You're installing ten things. Number seven fails. Now you have six things installed, one broken, and three that never got attempted. What do you do? Uninstall manually? Start over? Just live with it?

nexus-engine handles this differently. It installs things in priority order. Foundation packages first, then languages, then tools. If a foundation package fails, it removes everything it already installed that run. You're never left with a half-working setup.

It also checks things before it starts. Disk space, network connectivity, whether you have the right permissions. It tells you upfront if something is going to be a problem instead of failing halfway through.

You Can Share and Reuse Setups

I have a base setup that I use on every machine. Git, curl, a few essentials. Then I have specific setups for different projects. One for web development. One for data science. One for a particular client's stack.

nexus-engine lets you layer these on top of each other. A data science setup can extend the base setup. You only define what's different. The rest is inherited.

name: data-science
extends: base-dev
packages:
  - name: python3
    category: language
  - name: jupyter
    category: tool
  - name: pandas
    category: tool
Enter fullscreen mode Exit fullscreen mode

You can also share setups with other people. Your team can use the same setup file. New team member joins, they run one command, they have the same environment as everyone else.

You Should Be Able to Trust It

Here's the thing about a tool that installs stuff on your machine. You need to trust it.

I thought about this a lot. So I made some decisions early on.

It doesn't run whatever it wants. Every command goes through a strict allowlist. If it's not on the list, it doesn't run. No shell metacharacters, no arbitrary execution, no surprises.

It checks setup files for tampering. Every profile gets a SHA256 integrity check. If someone modifies your setup file, nexus-engine will notice and refuse to use it.

Downloads are verified. When it downloads a Linux rootfs or a remote profile, it checks that what it received is what it expected. No man-in-the-middle surprises.

Your state is tracked. It keeps a record of everything it installed, when, and why. You can always see what's on your machine and where it came from.

Getting Started

It's a single binary. No dependencies. Download it and run.

# Install with Go
go install github.com/Sumama-Jameel/nexus-engine/cmd/nexus@latest

# Or download a binary from the releases page
# https://github.com/Sumama-Jameel/nexus-engine/releases

# Initialize your environment
nexus init
Enter fullscreen mode Exit fullscreen mode

On Windows, the fastest path to Linux:

nexus wsl setup
nexus wsl enter
Enter fullscreen mode Exit fullscreen mode

What's Next

This is v1.0.0. It works for my use case and I've been using it daily. But I built it in the open because I want it to work for more people.

Things I'm thinking about:

  • More rootfs options for WSL2
  • A community directory of shared setups
  • Better Windows support beyond WSL
  • Package managers I haven't covered yet

If any of this sounds useful to you, check it out:

github.com/Sumama-Jameel/nexus-engine

Apache 2.0, fully open source. Read the code, open an issue, tell me what's missing. I want this to be something people actually trust to run on their machines. That bar is high and I want to clear it.

Top comments (0)