Skip to main content

← Crash log Run 001

Nix Flakes for SDET Setup

Set up a reproducible SDET workstation on macOS, Linux or WSL2 in about five minutes with Nix Flakes, then reuse it in CI with nix develop.

Run 001 6 zones 16 samples (sh 14, dockerfile 1, nix 1) 0 diagrams 0 compares

The Quick Setup

I've created a Nix Flakes repository for reproducible SDET environments across Mac, Linux, and Windows (WSL2). To get started:

Step 1: Install Nix (2 minutes)

curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install

Step 2: Clone and Customize (1 minute)

git clone https://github.com/crashnaut/nix.git
cd nix/mac

Edit flake.nix to set your username and hostname, and customize the package list.

Step 3: Apply Configuration (2 minutes)

nix run nix-darwin -- switch --flake .#your-hostname

All your tools are now installed and configured.

What's Included

Development Tools

  • Git, GitHub CLI, Vim, GPG
  • Node.js 22 (LTS) with pnpm package manager
  • OrbStack (fast, lightweight Docker alternative, Mac only)
  • Postman for poking at APIs
  • Language toolchains ready to add

CLI Utilities

  • Modern tools: ripgrep, bat, fd, eza
  • System monitoring: htop, btop
  • Essentials: curl, wget, jq
  • Zsh with Oh My Zsh

Personal Apps

The repo also installs a few GUI apps I use day to day (browser, chat, notes). They're personal picks rather than SDET requirements, so strip them out of flake.nix before you apply it.

Daily Workflow

Update Everything

nix flake update
darwin-rebuild switch --flake .

Add a Package

  1. Find it at search.nixos.org
  2. Add to your flake.nix
  3. Rebuild
packages = with pkgs; [
# ... existing packages
neofetch # New package
];

Rollback on Issues

darwin-rebuild switch --rollback

SDET Use Cases

Consistent Test Environments

Give your test project its own flake.nix with a devShells output, then use it locally and in CI to eliminate environment drift:

nix develop # interactive shell, same tools everywhere
nix develop --command npx playwright test # non-interactive, for CI

Quick CI/CD Setup

FROM nixos/nix
# Flakes are still behind an experimental flag
ENV NIX_CONFIG="experimental-features = nix-command flakes"
WORKDIR /app
# Build the dev shell once so it's cached in an image layer
COPY flake.nix flake.lock ./
RUN nix develop --command true
COPY . .
# Run your test command inside the dev shell, non-interactively
CMD ["nix", "develop", "--command", "npm", "test"]

nix develop on its own opens an interactive shell, which goes nowhere in a RUN step, so always pass --command.

Multi-Platform Testing

Configurations for Mac, Linux, and Windows ensure your automation works everywhere.

Team Onboarding

Three commands instead of a 20-page doc:

curl <install-nix>
git clone <your-nix-repo>
nix run <platform-command>

Get Started

Check out the repository for platform-specific configurations:

Each includes detailed READMEs with troubleshooting guides.

Quick FAQ

Will this conflict with my existing tools?
No. Nix installs to /nix separately. Uninstall anytime with /nix/nix-installer uninstall.

Disk space needed?
~2GB initially. Use nix-collect-garbage to clean old generations.

Works with Docker?
Yes. OrbStack is included on Mac (faster and lighter than Docker Desktop). Linux uses native Docker.


Questions? Open an issue on GitHub or check the Nix docs.