Skip to content

Deployment Guides

Platform-specific deployment guides for this Nix configuration.


This section covers deploying your Nix configuration across different platforms:

  • macOS (Darwin) - ✅ Current
  • Linux (NixOS) - 📋 Planned
  • Cloud (EC2/GCE) - 📋 Planned

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


Terminal window
# 1. Install Nix
curl -fsSL https://install.determinate.systems/nix | sh -s -- install --determinate
# 2. Clone config
git clone https://github.com/yourusername/Config.git ~/Config
cd ~/Config
# 3. First-time setup
sudo nix run nix-darwin -- switch --flake .#your-mac
# 4. Subsequent updates
darwin-rebuild switch --flake .#your-mac

See Darwin Deployment for details.

Terminal window
# Boot NixOS installer
# Partition and mount disks
# Clone config
git clone https://github.com/yourusername/Config.git /mnt/etc/nixos
cd /mnt/etc/nixos
# Install
nixos-install --flake .#linux-workstation

See NixOS Deployment for planned approach.

Terminal window
# Build AMI
nix build .#images.aws
# Deploy with Terraform
terraform apply
# Or deploy remotely
nixos-rebuild switch --flake .#ec2-instance \
--target-host user@instance-ip

See Cloud Deployment for planned approach.


FeaturemacOS (Darwin)Linux (NixOS)Cloud
Status✅ Current📋 Planned📋 Planned
Package ManagerNix + HomebrewNix onlyNix only
Service Managerlaunchdsystemdsystemd
Boot ManagermacOSGRUB/systemd-bootCloud boot
User ManagementmacOS nativeDeclarativeDeclarative
Remote Deploy✅ Yes✅ Yes✅ Yes

1. Install Nix + Homebrew
2. Clone configuration
3. Customize for machine
4. First-time activation (sudo)
5. Subsequent updates (no sudo)
1. Boot NixOS installer
2. Partition disks
3. Clone configuration
4. nixos-install
5. Reboot and manage
1. Build cloud image
2. Upload to AWS/GCP
3. Launch instance
4. Remote deployment
5. Auto-scaling (optional)

macOS:

Terminal window
nix flake update && darwin-rebuild switch --flake .#your-mac

NixOS (planned):

Terminal window
nix flake update && nixos-rebuild switch --flake .#hostname

macOS:

Terminal window
darwin-rebuild switch --rollback

NixOS (planned):

Terminal window
nixos-rebuild switch --rollback

macOS:

Terminal window
# Create host config
cp hosts/wikigen-mac.nix hosts/new-mac.nix
# Add to flake.nix
# Deploy on new machine

NixOS (planned):

Terminal window
# Create host config
# Add to flake.nix
# Install from ISO

nix/modules/common.nix
# Common across all platforms
{
environment.systemPackages = [ pkgs.git pkgs.vim ];
programs.zsh.enable = true;
}
nix/modules/darwin-base.nix
# 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;
}
# Works on both platforms
{
environment.systemPackages = with pkgs; [
git
vim
] ++ lib.optionals stdenv.isDarwin [
darwin.trash
] ++ lib.optionals stdenv.isLinux [
systemd
];
}

See Darwin Deployment - Troubleshooting

Common issues:

  • Build failures
  • Permission errors
  • Homebrew conflicts

Common issues:

  • Boot loader problems
  • Network configuration
  • Driver issues

Common issues:

  • Image build failures
  • Network connectivity
  • Cloud-init problems

Terminal window
# Always commit before major changes
git add .
git commit -m "Update configuration"
# Test build
darwin-rebuild build --flake .#hostname
# If good, apply
darwin-rebuild switch --flake .#hostname
Terminal window
# Test in VM first
nix build .#nixosConfigurations.test-vm.config.system.build.vm
./result/bin/run-test-vm-vm
# Then deploy to production
Terminal window
# Backup generations
darwin-rebuild --list-generations
# Keep configuration in git
git push origin main
# Export flake for offline use
nix flake archive

  • ✅ nix-darwin integration
  • ✅ Home Manager support
  • ✅ Homebrew integration
  • ✅ Multi-machine support
  • linux-base module
  • NixOS configurations
  • VM testing
  • Documentation
  • nixos-generators setup
  • AWS AMI builds
  • GCP image builds
  • Terraform integration
  • Kubernetes manifests
  • GitOps with Flux
  • Automated CI/CD
  • Multi-cloud support



Ready to deploy? Start with Darwin Deployment!