@kunchenguid: my new video is up! this is a popular request I received from my last video about agentic engineering workflow full wal…
Summary
A detailed walkthrough of setting up a reproducible declarative development environment for agentic engineering on macOS using Nix, Homebrew, Home Manager, WezTerm, and Starship.
View Cached Full Text
Cached at: 07/05/26, 08:38 PM
TL;DR
Starting from a fresh Mac, build a reproducible, declarative agentic engineering development environment step by step using Nix Darwin, Home Manager, WezTerm, Starship, and more.
Why a Reproducible Configuration Matters
Manually setting up a new machine (or quickly recovering after an AI agent crashes your system) is both time‑consuming and error‑prone. My solution is Nix – a declarative, reproducible configuration system originally designed for NixOS, but now fully usable on macOS via the Determinate Nix installer.
Step 1: Install Nix
- Open a terminal and run the Determinate Nix install command (see the video description).
- Type
yesand wait for the installation to finish. - Run the refresh command shown in the prompt to activate the new environment.
Step 2: Create the Config Repo & Nix Darwin
Initialize the repository
mkdir files && cd files
git init
ln -s "$(pwd)" ~/files # Create a fixed symlink so scripts can refer to it easily
Configure Nix Darwin
flake.nix template (remember to replace the username and version):
{
description = "macOS configuration";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/23.11"; # Pin a stable version
nix-darwin.url = "github:LnL7/nix-darwin/23.11";
};
outputs = { self, nix-darwin, nixpkgs }: {
darwinConfigurations.mac = nix-darwin.lib.darwinSystem {
modules = [ ./configuration.nix ];
};
};
}
Basic configuration.nix:
{ config, pkgs, ... }: {
nix.enable = false; # Managed by Determinate Nix
nixpkgs.config.allowUnfree = true;
system.stateVersion = 6;
networking.hostName = "mac"; # Example
users.users."your-username".home = "/Users/your-username"; # Replace
# System preferences, Homebrew, Home Manager modules will be added here later
}
Apply the configuration
git add -A && git commit -m "initial nix-darwin config"
nix run nix-darwin -- switch --flake .
Create a quick rebuild script rebuild.sh:
#!/bin/bash
nix run nix-darwin -- switch --flake .
chmod +x rebuild.sh
Step 3: Configure macOS System Preferences
Add system settings to configuration.nix (example):
system.defaults = {
NSGlobalDomain.AppleInterfaceStyle = "Dark";
NSGlobalDomain.KeyRepeat = 2; # Fast key repeat
NSGlobalDomain.InitialKeyRepeat = 15; # Short delay
dock.autohide = true;
dock.orientation = "bottom";
finder.AppleShowAllExtensions = true;
finder.FXPreferredViewStyle = "Nlsv"; # List view
desktop.ViewOptions = { ShowDesktopIcons = false; };
trackpad.Clicking = true; # Tap to click
};
Run ./rebuild.sh – the settings take effect immediately.
Step 4: Manage Homebrew with Nix
To keep everything fully reproducible, install Homebrew through Nix. Add the input and module to flake.nix:
inputs = {
# ... existing ...
nix-homebrew.url = "github:zhaofengli/nix-homebrew";
homebrew-bundle = { url = "github:homebrew/homebrew-bundle"; flake = false; };
homebrew-core = { url = "github:homebrew/homebrew-core"; flake = false; };
homebrew-cask = { url = "github:homebrew/homebrew-cask"; flake = false; };
};
outputs = {
# ... existing ...
nix-homebrew.lib, homebrew-bundle, homebrew-core, homebrew-cask, ...
}: {
darwinConfigurations.mac = nix-darwin.lib.darwinSystem {
modules = [
./configuration.nix
nix-homebrew.darwinModules.nix-homebrew
{
nix-homebrew = {
enable = true;
enableRosetta = true; # Required on Apple Silicon
user = "your-username";
};
homebrew = {
enable = true;
cleanup = "zap"; # Remove packages not in Nix config
casks = [
"wezterm" # My terminal of choice
# Add other casks here
];
};
}
];
};
};
Run ./rebuild.sh – Homebrew and WezTerm are installed automatically. Verify with brew --version.
Step 5: Home Manager – Manage the User Directory
Home Manager handles user‑level configuration (dotfiles, packages, environment variables). Add to flake.nix:
inputs = {
# ... existing ...
home-manager.url = "github:nix-community/home-manager";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = {
# ... existing ...
home-manager, ...
}: {
darwinConfigurations.mac = nix-darwin.lib.darwinSystem {
modules = [
# ... existing ...
home-manager.darwinModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users."your-username" = import ./home.nix;
}
];
};
};
Create home.nix (initial content):
{ config, pkgs, ... }: {
home.username = "your-username";
home.homeDirectory = "/Users/your-username";
home.stateVersion = "23.11";
# Create a symlink to the dotfiles repo
home.file.".config/wezterm".source = ./config/wezterm;
# User‑level packages
home.packages = with pkgs; [
hack-font # Hack Nerd Font
# Other user‑level packages
];
# Environment variables
home.sessionVariables = {
EDITOR = "nvim";
};
}
Create the config/wezterm directory – we’ll fill it with configuration later.
Step 6: Shell Enhancements (Zsh + Starship)
Autosuggestions & Syntax Highlighting
Add to home.nix:
programs.zsh = {
enable = true;
enableAutosuggestions = true;
enableSyntaxHighlighting = true;
initExtra = ''
# Ctrl+F accepts autosuggestion
bindkey '^f' autosuggest-accept
'';
shellAliases = {
ll = "ls -la";
gs = "git status";
ga = "git add";
gc = "git commit";
};
};
Starship Prompt
Continue adding to home.nix:
programs.starship = {
enable = true;
settings = {
add_newline = false;
# More customisation options – see Starship docs
};
};
Run ./rebuild.sh – the new terminal session picks up the changes automatically.
Step 7: WezTerm – The Ultimate Terminal
WezTerm is a high‑performance terminal written in Rust, with cross‑platform Lua configuration. Create ~/.config/wezterm/wezterm.lua:
local wezterm = require 'wezterm'
return {
-- Colour scheme
color_scheme = "Rosé Pine Moon",
-- Font
font = wezterm.font("Hack Nerd Font", { size = 15 }),
-- Transparency & blur
window_background_opacity = 0.85,
macos_window_background_blur = 20,
-- Hide tab bar when only one tab is open
hide_tab_bar_if_only_one_tab = true,
-- Frameless window
window_decorations = "RESIZE",
}
Save the file – WezTerm hot‑reloads automatically, and the effect is visible immediately.
Step 8: Neovim – The Main Editor
Create the initial config directory and file:
mkdir -p ~/.config/nvim
touch ~/.config/nvim/init.lua
Then edit init.lua with Neovim and gradually add plugins and settings (later this configuration can be managed through Home Manager to make it reproducible).
Source: YouTube Video by @kunchenguid (https://www.youtube.com/watch?v=5N-okeDdIuI)
Similar Articles
@yanhua1010: The most comprehensive introduction I've seen so far about 'Agentic Engineering Workflow'. Spent an hour reading through it completely — it could easily be turned into a paid tutorial. It covers tmux, agent memory, skills, voice input, long task execution, parallel worktree management…
Recommends a comprehensive introduction to 'Agentic Engineering Workflow', covering tmux, agent memory, skills, voice input, long task execution, parallel worktree management, multi-agent scheduling, along with the visual HTML editor Lavish and a code change validation pipeline: no-mistakes.
@jamonholmgren: I'm just going to dump my whole agentic setup out here, because I see too many people missing giant chunks of this and …
Jamon Holmgren shares his comprehensive agentic development setup, including workflow docs, self-healing docs, cross-agent review, automated testing, and autonomous agent loops.
@Zephyr_hg: https://x.com/Zephyr_hg/status/2062176187384807488
A practical guide arguing that mastering sub-agents requires building four specific workflows in a weekend, covering decomposition, context packaging, verification, and cost control, rather than spending 200 hours on tutorials.
@kunchenguid: time to reveal my HTML workflow with agents HTML is the new markdown. Lavish is the new editor for your HTML artifacts …
The article introduces 'Lavish', an open-source local tool for HTML workflows and editing using AI agents, claiming HTML is the new markdown.
@DeRonin_: anybody who uses or learns agentic systems, SHOULD READ THIS the install order I run before any new agentic project: 1.…
A thread sharing a structured install order for agentic projects: using direnv with a secrets manager for credential safety, litellm or portkey as a model proxy for cost and fallback management, uv+git commits on passing evals for reproducibility, and mitmproxy for full observability of LLM calls. Highlights common failure modes and security gaps.