Fast SDET Setup with Nix Flakes

profile
Mike Sell
crashnaut.com

The Problem: Machine Setup Shouldn't Take Hours link

As an SDET how many times have you had to set up a new machine? Whether it's a new laptop, a CI runner, or helping a teammate get started, the process is painful:

What if you could go from a fresh machine to a fully configured development environment in 5 minutes?

The Solution: Nix Flakes link

I've created a Nix Flakes repository that provides reproducible development environments across Mac, Linux, and Windows (WSL2). The entire setup is declarative, version-controlled, and atomic.

Why Nix Flakes? link

Declarative Configuration: Your entire environment is defined in a single flake.nix file. Want to know what's installed? Just read the file.

Reproducible: The same configuration produces the same result every time, on every machine. No more "it worked yesterday" mysteries.

Atomic Updates: Changes either succeed completely or rollback automatically. No more broken environments from partial updates.

Cross-Platform: The same approach works on Mac, Linux, and Windows (via WSL2).

Version Control: Your environment configuration is just code. Track changes, branch, and merge like any other codebase.

What's Included link

The repository includes platform-specific configurations for:

Development Tools link

CLI Utilities link

GUI Applications (Mac/Linux) link

All customizable to your needs!

The 5-Minute Setup link

Step 1: Install Nix (2 minutes) link

This installs Nix using the Determinate Systems installer, which provides a better experience than the official installer.

Step 2: Clone and Customize (1 minute) link

Edit the flake.nix file to customize:

Step 3: Apply the Configuration (2 minutes) link

That's it! All your tools and applications are now installed and configured.

Real-World Benefits for SDETs link

Consistent Test Environments link

Ever had a test pass locally but fail in CI? With Nix, you can ensure your local environment matches your CI environment exactly. The same flake.nix that sets up your laptop can configure your CI runners.

Quick CI/CD Agent Setup link

Need to spin up new test runners? Instead of maintaining complex setup scripts, use your Nix configuration:

Testing Across Multiple OS link

The repository includes configurations for Mac, Linux, and Windows. Test your automation scripts across all platforms with confidence that each environment is properly configured.

Onboarding Made Simple link

New team member? Instead of a 20-page setup document that's probably outdated, give them three commands:

Daily Usage link

Once set up, managing your environment is straightforward:

Updating Everything link

Adding a New Package link

  1. Find the package at search.nixos.org
  2. Add it to your flake.nix
  3. Run the rebuild command

Something Broke? Rollback! link

Nix keeps track of previous configurations. If an update breaks something:

Customization Guide link

The flake.nix files are heavily commented and designed for modification:

Adding Packages link

Adding Homebrew Apps (macOS) link

Configuring Git link

Shell Aliases link

Platform-Specific Details link

The repository has three separate configurations optimized for each platform:

macOS (mac/) link

Linux (linux/) link

Windows WSL2 (windows/) link

Each platform has its own detailed README with specific instructions and troubleshooting.

Getting Started link

Ready to try it? Check out the repository and choose your platform:

Common Questions link

Q: Will this mess up my existing setup?

No! Nix installs everything to /nix and doesn't touch your existing packages. You can try it safely and uninstall anytime with /nix/nix-installer uninstall.

Q: What's the disk space requirement?

Initial install is about 2GB. It grows over time as you add packages, but Nix has built-in garbage collection to clean up old versions.

Q: Can I use this for work machines?

Yes! Many companies use Nix for development environments. Just check your company's IT policies first.

Q: What if I need a package that's not in nixpkgs?

You can still use npm, pip, gem, etc. alongside Nix. Or you can package it yourself using Nix's derivation system.

Q: Does this work with Docker?

Absolutely! Docker (or OrbStack on Mac) is included in the configuration. You can also use Nix to build Docker images with reproducible layers.

Conclusion link

As SDETs and automation engineers, our job is to make software delivery reliable and repeatable. Why not apply the same principles to our own development environments?

With Nix Flakes, you get:

The repository is open source and ready to use. Clone it, customize it, and never waste hours on machine setup again.


Have questions or improvements? The repo is on GitHub – PRs welcome!

Want to learn more about Nix? Check out the official documentation and the NixOS Discourse.

Feel free to update this blog post on GitHub, thanks in advance!

Share this post

Support me

I appreciate it if you would support me if you have enjoyed this post and found it useful, thank you in advance.

Buy Me a Coffee at ko-fi.com