Deployment Guides
Platform-specific deployment guides for this Nix configuration.
Overview
Section titled “Overview”This section covers deploying your Nix configuration across different platforms:
- macOS (Darwin) - ✅ Current
- Linux (NixOS) - 📋 Planned
- Cloud (EC2/GCE) - 📋 Planned
Documentation in This Section
Section titled “Documentation in This Section”Fully implemented - Complete macOS deployment guide.
Covers:
- Initial deployment on macOS
- System updates and management
- Generation management
- Rollback and recovery
- Multi-machine setup
Status: ✅ Production ready
Planned - NixOS deployment guide.
Will cover:
- NixOS installation
- Shared configuration with macOS
- Systemd service management
- Linux-specific optimizations
Status: 📋 Designed, not yet implemented
Planned - AWS EC2 and GCP GCE deployment.
Will cover:
- Building cloud images
- AWS EC2 deployment
- GCP GCE deployment
- Terraform integration
- Auto-scaling
Status: 📋 Designed, not yet implemented
Quick Start
Section titled “Quick Start”Deploy on macOS
Section titled “Deploy on macOS”# 1. Install Nixcurl -fsSL https://install.determinate.systems/nix | sh -s -- install --determinate
# 2. Clone configgit clone https://github.com/yourusername/Config.git ~/Configcd ~/Config
# 3. First-time setupsudo nix run nix-darwin -- switch --flake .#your-mac
# 4. Subsequent updatesdarwin-rebuild switch --flake .#your-mac
See Darwin Deployment for details.
Deploy on NixOS (Planned)
Section titled “Deploy on NixOS (Planned)”# Boot NixOS installer# Partition and mount disks
# Clone configgit clone https://github.com/yourusername/Config.git /mnt/etc/nixoscd /mnt/etc/nixos
# Installnixos-install --flake .#linux-workstation
See NixOS Deployment for planned approach.
Deploy to Cloud (Planned)
Section titled “Deploy to Cloud (Planned)”# Build AMInix build .#images.aws
# Deploy with Terraformterraform apply
# Or deploy remotelynixos-rebuild switch --flake .#ec2-instance \ --target-host user@instance-ip
See Cloud Deployment for planned approach.
Platform Comparison
Section titled “Platform Comparison”Feature | macOS (Darwin) | Linux (NixOS) | Cloud |
---|---|---|---|
Status | ✅ Current | 📋 Planned | 📋 Planned |
Package Manager | Nix + Homebrew | Nix only | Nix only |
Service Manager | launchd | systemd | systemd |
Boot Manager | macOS | GRUB/systemd-boot | Cloud boot |
User Management | macOS native | Declarative | Declarative |
Remote Deploy | ✅ Yes | ✅ Yes | ✅ Yes |
Deployment Workflows
Section titled “Deployment Workflows”macOS Workflow
Section titled “macOS Workflow”1. Install Nix + Homebrew ↓2. Clone configuration ↓3. Customize for machine ↓4. First-time activation (sudo) ↓5. Subsequent updates (no sudo)
NixOS Workflow (Planned)
Section titled “NixOS Workflow (Planned)”1. Boot NixOS installer ↓2. Partition disks ↓3. Clone configuration ↓4. nixos-install ↓5. Reboot and manage
Cloud Workflow (Planned)
Section titled “Cloud Workflow (Planned)”1. Build cloud image ↓2. Upload to AWS/GCP ↓3. Launch instance ↓4. Remote deployment ↓5. Auto-scaling (optional)
Common Tasks
Section titled “Common Tasks”Update System
Section titled “Update System”macOS:
nix flake update && darwin-rebuild switch --flake .#your-mac
NixOS (planned):
nix flake update && nixos-rebuild switch --flake .#hostname
Rollback
Section titled “Rollback”macOS:
darwin-rebuild switch --rollback
NixOS (planned):
nixos-rebuild switch --rollback
Add New Machine
Section titled “Add New Machine”macOS:
# Create host configcp hosts/wikigen-mac.nix hosts/new-mac.nix
# Add to flake.nix# Deploy on new machine
NixOS (planned):
# Create host config# Add to flake.nix# Install from ISO
Multi-Platform Configuration
Section titled “Multi-Platform Configuration”Shared Configuration
Section titled “Shared Configuration”# Common across all platforms{ environment.systemPackages = [ pkgs.git pkgs.vim ];
programs.zsh.enable = true;}
Platform-Specific
Section titled “Platform-Specific”# macOS only{ homebrew.enable = true; system.defaults.dock.autohide = true;}
# Linux only# nix/modules/linux-base.nix{ boot.loader.systemd-boot.enable = true; services.openssh.enable = true;}
Conditional Configuration
Section titled “Conditional Configuration”# Works on both platforms{ environment.systemPackages = with pkgs; [ git vim ] ++ lib.optionals stdenv.isDarwin [ darwin.trash ] ++ lib.optionals stdenv.isLinux [ systemd ];}
Troubleshooting
Section titled “Troubleshooting”macOS Issues
Section titled “macOS Issues”See Darwin Deployment - Troubleshooting
Common issues:
- Build failures
- Permission errors
- Homebrew conflicts
NixOS Issues (Planned)
Section titled “NixOS Issues (Planned)”Common issues:
- Boot loader problems
- Network configuration
- Driver issues
Cloud Issues (Planned)
Section titled “Cloud Issues (Planned)”Common issues:
- Image build failures
- Network connectivity
- Cloud-init problems
Best Practices
Section titled “Best Practices”Version Control
Section titled “Version Control”# Always commit before major changesgit add .git commit -m "Update configuration"
# Test builddarwin-rebuild build --flake .#hostname
# If good, applydarwin-rebuild switch --flake .#hostname
Testing
Section titled “Testing”# Test in VM firstnix build .#nixosConfigurations.test-vm.config.system.build.vm./result/bin/run-test-vm-vm
# Then deploy to production
Backup
Section titled “Backup”# Backup generationsdarwin-rebuild --list-generations
# Keep configuration in gitgit push origin main
# Export flake for offline usenix flake archive
Roadmap
Section titled “Roadmap”✅ Phase 1: macOS (Complete)
Section titled “✅ Phase 1: macOS (Complete)”- ✅ nix-darwin integration
- ✅ Home Manager support
- ✅ Homebrew integration
- ✅ Multi-machine support
📋 Phase 2: NixOS (Planned)
Section titled “📋 Phase 2: NixOS (Planned)”- linux-base module
- NixOS configurations
- VM testing
- Documentation
📋 Phase 3: Cloud (Planned)
Section titled “📋 Phase 3: Cloud (Planned)”- nixos-generators setup
- AWS AMI builds
- GCP image builds
- Terraform integration
🔮 Phase 4: Advanced (Future)
Section titled “🔮 Phase 4: Advanced (Future)”- Kubernetes manifests
- GitOps with Flux
- Automated CI/CD
- Multi-cloud support
Related Documentation
Section titled “Related Documentation”In This Section
Section titled “In This Section”- Darwin Deployment - macOS guide
- NixOS Deployment - Linux guide (planned)
- Cloud Deployment - Cloud guide (planned)
Other Sections
Section titled “Other Sections”- Getting Started - Initial setup
- Architecture - Design docs
- Examples - Practical examples
External Resources
Section titled “External Resources”- nix-darwin - macOS support
- NixOS - Linux distribution
- nixos-generators - Image builder
- Terranix - Terraform in Nix
Ready to deploy? Start with Darwin Deployment!