···
+
# Script to start all services in tmux
+
all = pkgs.writeShellScriptBin "all" ''
+
# Check if tmux is available
+
if ! command -v tmux >/dev/null 2>&1; then
+
echo "❌ tmux is not installed. Please install tmux first."
+
# Check if certificates exist
+
if [ ! -f "./certs/cert.pem" ]; then
+
echo "⚠️ WARNING: SSL certificates not found. Run 'nix run .#generate-certs' first."
+
read -p "Continue anyway? (y/N): " -n 1 -r
+
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
+
# Check if hosts file is configured
+
if ! grep -q "pds.example.org" /etc/hosts 2>/dev/null; then
+
echo "⚠️ WARNING: Please add these lines to your /etc/hosts file:"
+
echo " 127.0.0.1 pds.example.org"
+
echo " 127.0.0.1 plc.example.org"
+
# Kill existing session if it exists
+
tmux kill-session -t atproto 2>/dev/null || true
+
echo "🚀 Starting AT Protocol services in tmux..."
+
# Create new tmux session with PLC server
+
tmux new-session -d -s atproto "${plc}/bin/plc"
+
# Split horizontally for PDS server
+
tmux split-window -h -t atproto "${pds}/bin/pds"
+
# Split the right pane vertically for Caddy proxy
+
tmux split-window -v -t atproto.1 "${caddy-proxy}/bin/caddy-proxy"
+
# Split the left pane vertically for MailHog
+
tmux split-window -v -t atproto.0 "${mailhog}/bin/mailhog"
+
# Select the first pane
+
tmux select-pane -t atproto.0
+
echo "✅ Services started in tmux session 'atproto'"
+
echo "📋 Available commands:"
+
echo " tmux attach -t atproto - Attach to the session"
+
echo " tmux kill-session -t atproto - Stop all services"
+
echo "🔲 Panes layout (2x2 grid):"
+
echo " • Top-left: PLC server"
+
echo " • Bottom-left: MailHog server"
+
echo " • Top-right: PDS server"
+
echo " • Bottom-right: Caddy proxy"
+
echo "💡 Use Ctrl+b followed by arrow keys to switch between panes"
+
# Development shell with tools (no automatic service management)
devShells.${system}.default = pkgs.mkShell {
buildInputs = with pkgs; [
···
+
echo "🚀 AT Protocol Development Environment"
+
echo "🌐 Services will be available at:"
+
echo " • Bluesky PDS: https://pds.example.org:8443"
+
echo " • DID PLC: https://plc.example.org:8444"
+
echo " • MailHog: http://localhost:8025"
+
echo "🛠️ Available tools: bluesky-pdsadmin, goat"
+
echo "💡 Available packages:"
+
echo " nix run .#all - Start all services in tmux (recommended)"
+
echo " nix run .#plc - Start PLC server"
+
echo " nix run .#pds - Start PDS server"
+
echo " nix run .#caddy-proxy - Start Caddy proxy"
+
echo " nix run .#mailhog - Start MailHog"
+
echo " nix run .#generate-certs - Generate SSL certificates"
+
echo "🚀 Quick start: nix run .#all"
+
echo "ℹ️ Note: You control when services start and stop"
+
export PS1='[AT Proto Dev] \u@\h:\w\$ '