This configuration provides a completely separated setup with nix-darwin for system configuration and standalone Home Manager for user configuration.
- Important Notes
- Architecture
- Initial Setup
- Package Distribution
- Usage
- Testing Your Setup
- Shell Configuration
- Directory Structure
- Dev Shells
- Separated Setup Migration Instructions
Important
This configuration uses nixpkgs-unstable. For production use, consider using stable channels.
Important
The setup is optimized for zsh. If using a different shell, adjust configurations accordingly.
Warning
Always test changes in a non-production environment first.
- System Configuration: Managed by nix-darwin (
darwin/configuration.nix) - User Configuration: Managed by standalone Home Manager (
home/home.nix) - Complete Independence: System and user configurations can be updated separately
- Install Nix with flakes support:
mkdir -p ~/.config/nix
echo 'experimental-features = nix-command flakes' >> ~/.config/nix/nix.conf- Install nix-darwin:
nix run nix-darwin --extra-experimental-features nix-command --extra-experimental-features flakes -- switch --flake ~/nix-config- Update usernames and hostnames in configuration files:
# Get your username
whoami
# Get your hostname
hostname
# Get your home directory
echo $HOME-
Edit
flake.nix:- Update
username = "nikitalenyk";to your username - Update
darwinConfigurations."MacBook-Pro-Nikita"to your hostname
- Update
-
Edit
home/home.nix:- Update
home.username = "nikitalenyk"; - Update
home.homeDirectory = "/Users/nikitalenyk"; - Update git
userNameanduserEmail
- Update
-
Apply the configuration:
cd ~/nix-config
sudo darwin-rebuild switch --flake .
home-manager switch --flake .home-manager # CLI tool for user config management
git # Essential for nix operations
curl # System networking tool
wget # System networking tool
vim # Fallback system editorwezterm # Terminal emulator
zoxide # Directory navigation
starship # Shell prompt
bat # Cat replacement with syntax highlighting
fd # Find replacement
ripgrep # Grep replacement
logisim-evolution # Logic circuit simulatorFor changes to system-level settings, packages, or Darwin configuration:
sudo darwin-rebuild switch --flake .For changes to user packages, dotfiles, or personal settings:
home-manager switch --flake .home-manager news # Read Home Manager updates
home-manager generations # List configuration generations
home-manager rollback # Roll back to previous generation-
Test System Configuration:
sudo darwin-rebuild switch --flake . -
Test Home Manager Configuration:
home-manager switch --flake . -
Verify Home Manager CLI:
which home-manager # Should return: /run/current-system/sw/bin/home-manager
The setup includes:
- Zsh with completion, autosuggestion, and syntax highlighting
- Zoxide for smart directory navigation
- Starship for a modern shell prompt
- Git configuration with user details
nix-config/
├── flake.nix # Main flake with both configurations
├── flake.lock # Lock file
├── darwin/
│ └── configuration.nix # System-level configuration
├── home/
│ └── home.nix # User-level configuration
├── dev-shells/ # Development environments
│ ├── cpp-cmake/
│ └── java-maven/
└── wezterm/ # Terminal configuration files
The wezterm is installed via Home Manager and configured separately.
- Create the wezterm config directory:
mkdir -p ~/.config/wezterm- Move the configuration files:
mv ~/nix-config/wezterm/* ~/.config/wezterm/Ctrl+A p- Project selectorCtrl+A f- Workspace selectorCtrl+A "- Horizontal splitCtrl+A %- Vertical splitCtrl+A h/j/k/l- Navigate between splitsCtrl+A r- Resize mode
Important
Create Projects and Workspaces directories to use the selectors:
mkdir -p ~/Projects ~/WorkspacesDevelopment environments are available for different languages:
nix develop ~/nix-config/dev-shells/java-mavennix develop ~/nix-config/dev-shells/cpp-cmake- The configuration now separates system and user packages
- Use
home-manager switch --flake .for user-level changes only - Use
sudo darwin-rebuild switch --flake .for system-level changes only