A cross-platform, declarative, and reproducible home environment configuration using Nix Flakes and Home Manager.
Features β’ Prerequisites β’ Installation β’ Usage β’ Customization β’ Troubleshooting
This configuration is currently set up for the username
oratakashi.If you want to use this configuration, you MUST customize it for your own username BEFORE applying it to your system. Applying it as-is may cause issues or unexpected behavior.
π Please read the Adjusting Configuration for Your Username section carefully before proceeding with the installation.
- First-Time User Notice
- Features
- Prerequisites
- Supported Platforms
- Installation
- Project Structure
- Configuration Overview
- Usage
- Customization
- Troubleshooting
- Contributing
- License
- π Cross-Platform Support - Works seamlessly on macOS (Intel & Apple Silicon), Linux, and Windows (WSL)
- π¦ Declarative Configuration - Define your entire development environment in code
- π Reproducible Builds - Same configuration yields identical results across machines
- β‘ Nix Flakes - Modern Nix with lockfile support for reproducibility
- π nix-darwin Integration - Full macOS system configuration support
- πΊ Homebrew Management - Automated Homebrew package management on macOS
- π Shell Configuration - Pre-configured Fish and Zsh with aliases and plugins
- π οΈ Development Tools - Ready-to-use development environment with common tools
Before you begin, ensure you have the following:
- A supported operating system (macOS, Linux, or Windows with WSL)
- Administrator/sudo access on your machine
- Internet connection for downloading packages
| Platform | Architecture | Configuration |
|---|---|---|
| macOS | Intel (x86_64) | darwinConfigurations.<username> (default: oratakashi) |
| macOS | Apple Silicon (aarch64) | darwinConfigurations.<username>-arm64 (default: oratakashi-arm64) |
| Linux | x86_64 | homeConfigurations.linux |
| Windows | WSL (x86_64) | homeConfigurations.windows |
Note:
<username>should be replaced with your actual username after customization. See Adjusting Configuration for Your Username.
β οΈ IMPORTANT: This configuration is set up for the useroratakashi. Before following the installation steps, you MUST customize it for your username. See the Adjusting Configuration for Your Username section in Customization for detailed instructions.
Install the Nix package manager using the Determinate Systems installer:
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- installNote: After installation, restart your terminal or source your shell configuration.
Clone this repository to ~/.config/home-manager:
Using SSH (recommended):
nix-shell -p git --command "git clone [email protected]:oratakashi/nix-home-manager.git $HOME/.config/home-manager"Using HTTPS:
nix-shell -p git --command "git clone https://github.com/oratakashi/nix-home-manager.git $HOME/.config/home-manager"Note: You can also fork this repository to your own GitHub account and clone from your fork if you want to maintain your own customizations.
β οΈ Remember: Before running these commands, make sure you've customized the configuration with your username. The commands below assume you've already updated the configuration files. Replace<username>with the username you configured in the customization step.
Choose the appropriate commands for your platform:
π macOS (Intel)
-
Build the initial configuration:
nix build ~/.config/home-manager#darwinConfigurations.<username>.system
Example: If you customized with username "john", use:
nix build ~/.config/home-manager#darwinConfigurations.john.system -
Apply the configuration:
cd ~/.config/home-manager ./result/sw/bin/darwin-rebuild switch --flake .#<username>
Example: If your username is "john":
./result/sw/bin/darwin-rebuild switch --flake .#john -
For subsequent updates, simply run:
home-update
π macOS (Apple Silicon / ARM64)
-
Build the initial configuration:
nix build ~/.config/home-manager#darwinConfigurations.<username>-arm64.system
Example: If you customized with username "john", use:
nix build ~/.config/home-manager#darwinConfigurations.john-arm64.system -
Apply the configuration:
cd ~/.config/home-manager ./result/sw/bin/darwin-rebuild switch --flake .#<username>-arm64
Example: If your username is "john":
./result/sw/bin/darwin-rebuild switch --flake .#john-arm64 -
For subsequent updates, simply run:
home-update
π§ Linux
-
Apply the Home Manager configuration:
nix run github:nix-community/home-manager -- switch --flake ~/.config/home-manager#linux -
(Optional) Change default shell to Fish or Zsh:
# For Fish (recommended - primary shell in this config) sudo usermod -s $(which fish) $(whoami) # For Zsh (alternative) sudo usermod -s $(which zsh) $(whoami)
-
For subsequent updates, simply run:
home-update
πͺ Windows (WSL)
-
Apply the Home Manager configuration:
nix run github:nix-community/home-manager -- switch --flake ~/.config/home-manager#windows -
For subsequent updates, simply run:
home-update
~/.config/home-manager/
βββ flake.nix # Main flake configuration (entry point)
βββ flake.lock # Locked dependencies for reproducibility
βββ darwin-configuration.nix # macOS-specific system configuration
βββ home-shared.nix # Shared configuration across all platforms
βββ home-darwin.nix # macOS-specific home configuration
βββ home-linux.nix # Linux-specific home configuration
βββ home-windows.nix # Windows/WSL-specific home configuration
βββ emulator-fix-hackintosh/ # Android emulator fix for Hackintosh
β βββ emulatorfix.plist
βββ README.md # Main documentation
βββ CUSTOMIZATION_GUIDE.md # Detailed guide for username customization
The following packages are installed across all platforms:
| Category | Packages |
|---|---|
| Terminal Tools | git, eza, fastfetch, btop, htop |
| Development | scrcpy, PHP 8.4, Composer |
| Build Tools | cmake, ninja, clang, Python 3.11, Node.js 20, Yarn |
| Editors | Neovim, Helix |
| Shell | Fish (with Starship prompt), Zsh (with Oh My Zsh) |
| Category | Packages/Settings |
|---|---|
| Homebrew Casks | Google Chrome, Firefox, Arc, 1Password, Warp Terminal, TeamViewer |
| Homebrew Brews | cloudflared, jmeter |
| System Settings | Auto-hide dock, Finder show extensions |
| Development | CocoaPods, wget, kdoctor, Kobweb CLI |
The configuration includes helpful aliases:
| Alias | Command | Description |
|---|---|---|
home-update |
Platform-specific | Update Home Manager configuration |
home-edit |
code ~/.config/home-manager |
Open config in VS Code |
ls |
eza --icons |
Enhanced directory listing |
cat |
bat |
Syntax-highlighted file viewer |
neofetch |
fastfetch |
System information display |
nix-clear |
nix-collect-garbage -d |
Clean up Nix store |
| Command | Description |
|---|---|
home-update |
Apply latest configuration changes |
home-edit |
Open configuration in VS Code |
nix-clear |
Clean up unused Nix packages |
To update all flake inputs to their latest versions:
cd ~/.config/home-manager
nix flake update
home-update-
For all platforms: Edit
home-shared.nixand add packages tohome.packages:home.packages = with pkgs; [ # Add your packages here ripgrep fd ];
-
For platform-specific packages: Edit the corresponding file:
- macOS:
home-darwin.nix - Linux:
home-linux.nix - Windows/WSL:
home-windows.nix
- macOS:
Edit the shellAliases section in home-shared.nix:
programs.fish.shellAliases = {
# Add your aliases here
myalias = "my-command --with-flags";
};
β οΈ Important: This configuration is currently set up for the useroratakashi. Before using it for your own system, you must customize it with your username.π For a detailed standalone guide, see CUSTOMIZATION_GUIDE.md
The following table shows all files that need to be updated and what to change:
| File | What to Change | Example |
|---|---|---|
flake.nix |
Configuration names (darwinConfigurations), users.oratakashi section, username and homeDirectory fields |
"oratakashi" β "yourusername" |
home-shared.nix |
home.username, PATH variables in Fish config |
"oratakashi" β "yourusername" |
darwin-configuration.nix |
system.primaryUser, users.users.oratakashi section |
oratakashi β yourusername |
home-darwin.nix |
home.homeDirectory, shell aliases for home-update |
/Users/oratakashi β /Users/yourusername |
home-linux.nix |
home.homeDirectory |
/home/oratakashi β /home/yourusername |
home-windows.nix |
home.homeDirectory |
/mnt/c/Users/oratakashi β /mnt/c/Users/yourusername |
Follow these steps carefully to customize the configuration for your username:
Replace all instances of oratakashi with your username:
Darwin Configurations (macOS):
# For Intel Macs - Change the configuration name and user settings
darwinConfigurations."yourusername" = darwin.lib.darwinSystem {
system = "x86_64-darwin";
modules = [
./darwin-configuration.nix
home-manager.darwinModules.home-manager
{
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
users.yourusername = { pkgs, ... }: { # Change here
home = {
username = "yourusername"; # Change here
homeDirectory = "/Users/yourusername"; # Change here
stateVersion = "23.11";
};
imports = [
./home-shared.nix
./home-darwin.nix
];
};
};
}
];
};
# For Apple Silicon Macs - Same changes as above
darwinConfigurations."yourusername-arm64" = darwin.lib.darwinSystem {
system = "aarch64-darwin";
# ... make the same username changes ...
};Change the username and PATH variables:
home.username = "yourusername"; # Change this line
# In programs.fish.interactiveShellInit, update the PATH:
set -l nix_paths \
/Users/yourusername/.nix-profile/bin \ # Change here
/etc/profiles/per-user/yourusername/bin # Change hereAlso update the session path if needed (note: adjust the path format for your platform):
home.sessionPath = [
"/home/yourusername/Documents/Tools/kobweb/bin" # For Linux/WSL
# Or for macOS: "/Users/yourusername/Documents/Tools/kobweb/bin"
];Change the primary user and user definition:
system.primaryUser = "yourusername"; # Change here
users.users.yourusername = { # Change here
name = "yourusername"; # Change here
home = "/Users/yourusername"; # Change here
};Change the home directory and shell aliases:
home.homeDirectory = "/Users/yourusername"; # Change here
# Update the home-update alias:
programs.zsh.shellAliases = {
home-update = "sudo darwin-rebuild switch --flake ~/.config/home-manager#yourusername"; # Change here
};
programs.fish.shellAliases = {
home-update = "sudo darwin-rebuild switch --flake ~/.config/home-manager#yourusername"; # Change here
};Change the home directory:
home.homeDirectory = "/home/yourusername"; # Change hereChange the Windows home directory:
home.homeDirectory = "/mnt/c/Users/yourusername"; # Change hereAfter making all the changes, verify your configuration before applying:
-
Check syntax:
cd ~/.config/home-manager nix flake check
-
Verify your changes:
# Search for any remaining references to the old username in Nix files only grep -r "oratakashi" ~/.config/home-manager --include="*.nix"
This should return no results if all changes were made correctly (documentation files may still contain "oratakashi" as examples, which is fine).
-
Show available configurations:
nix flake show ~/.config/home-managerYou should see your new username in the configuration names.
Once you've customized all files, apply the configuration for your platform:
macOS (Intel):
nix build ~/.config/home-manager#darwinConfigurations.yourusername.system
./result/sw/bin/darwin-rebuild switch --flake ~/.config/home-manager#yourusernamemacOS (Apple Silicon):
nix build ~/.config/home-manager#darwinConfigurations.yourusername-arm64.system
./result/sw/bin/darwin-rebuild switch --flake ~/.config/home-manager#yourusername-arm64Linux:
nix run github:nix-community/home-manager -- switch --flake ~/.config/home-manager#linuxWindows (WSL):
nix run github:nix-community/home-manager -- switch --flake ~/.config/home-manager#windowsConfiguration not found error
If you get an error like configuration 'yourusername' not found, double-check that you:
- Changed the configuration name in
flake.nix - Used the correct name in the build/switch command
- Saved all files before running the command
Permission denied on home directory
Ensure the home directory path matches your actual system username. Check with:
echo $HOMEStill seeing references to old username
Use this command to find any remaining references in Nix configuration files:
grep -r "oratakashi" ~/.config/home-manager --include="*.nix"Note: Documentation files (README.md, CUSTOMIZATION_GUIDE.md) may contain "oratakashi" as examples, which is expected and fine.
Nix command not found after installation
Restart your terminal or run:
source /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.shFlakes not enabled
Ensure flakes are enabled in your Nix configuration. The installer from Determinate Systems enables this by default.
Permission denied during darwin-rebuild
Some darwin-rebuild operations may require elevated permissions. Try running with sudo:
sudo darwin-rebuild switch --flake ~/.config/home-manager#<username>Replace <username> with your actual username (or <username>-arm64 for Apple Silicon).
Note: The initial installation typically doesn't require sudo, but subsequent system-level changes might.
Android Emulator not working on Hackintosh
Apply the emulator fix:
cp ~/.config/home-manager/emulator-fix-hackintosh/emulatorfix.plist ~/Library/LaunchAgents/
launchctl load ~/Library/LaunchAgents/emulatorfix.plist# Check Nix version
nix --version
# Verify flake configuration
nix flake check ~/.config/home-manager
# Show flake outputs
nix flake show ~/.config/home-manager
# Dry-run to see what would change
home-manager switch --flake ~/.config/home-manager#linux --dry-runContributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
Made with β€οΈ using Nix and Home Manager