This repository contains my personal environment configuration managed using Nix Flakes and Home Manager.
-
Shell: Zsh (custom settings sourced from
dotfiles/zshrc). -
Terminal Multiplexer: Tmux (with minimal-tmux-status plugin and custom settings from
dotfiles/tmux). -
Editor: Neovim (linked to external configuration via the nvim-config input).
-
Prompt: Starship (
dotfiles/starship.toml). -
Packages: Docker, Node.js, Python 3 environment, Git, GCC, and development utilities.
The Nix installation must support Flakes. If you don't have Nix, install it using the multi-user script:
curl -L https://nixos.org/nix/install | shAfter installation, ensure Flakes are enabled in your Nix configuration file (/etc/nix/nix.conf or ~/.config/nix/nix.conf):
experimental-features = nix-command flakes
macOS Users: See macOS Installation Guide for first-time setup instructions.
Clone the repository:
git clone https://github.com/ruizsamuel/dotfiles.git
cd dotfilesEdit config.nix with your personal data:
nano config.nix # or use your preferred editorUpdate the values:
{
username = "your-username";
homeDirectory = "/home/your-username"; # On macOS use /Users/your-username
git = {
userName = "Your Name";
userEmail = "your.email@example.com";
signing = {
enable = false; # Change to true if you want to sign commits with GPG
key = ""; # Your GPG fingerprint if needed
};
};
}Important:
config.nixis tracked in git. When pulling updates, back up your local changes first:cp config.nix config.nix.backup git pull # Restore your personal settings if needed
Apply the configuration:
Linux x86_64:
home-manager switch --flake .#samuelLinux ARM (Raspberry Pi, etc.):
home-manager switch --flake .#samuel@aarch64-linuxmacOS Apple Silicon:
home-manager switch --flake .#samuel@aarch64-darwinmacOS Intel:
home-manager switch --flake .#samuel@x86_64-darwinNote:
.#samueldefaults tox86_64-linux. Other architectures must be specified explicitly.
This configuration supports multiple architectures and operating systems:
- x86_64-linux: Linux on Intel/AMD processors
- aarch64-linux: Linux on ARM (Raspberry Pi, etc.)
- x86_64-darwin: macOS on Intel
- aarch64-darwin: macOS on Apple Silicon (M1/M2/M3/etc.)
Always specify your system explicitly when running home-manager switch as shown in the Install Configuration section above.
Note: The configuration is portable across architectures. Nix handles dependency resolution for each platform automatically. However, you must specify your system explicitly in the flake command (e.g.,
@aarch64-darwin,@x86_64-linux). If you need OS-specific packages, they can be conditionally included usinglib.optionals stdenv.isLinuxorlib.optionals stdenv.isDarwininhome.nix.
This section provides specific instructions for setting up this configuration on macOS for the first time.
-
Install Nix (if not already installed):
curl -L https://nixos.org/nix/install | sh -
Enable Flakes in
~/.config/nix/nix.conf(create if it doesn't exist):experimental-features = nix-command flakes -
Restart your terminal to apply changes.
-
Install Home Manager standalone:
nix run home-manager/master -- init --switch
-
Replace the generated configuration with this repository:
cd ~/.config/home-manager rm -rf * # Remove auto-generated files # Clone this repository git clone https://github.com/ruizsamuel/dotfiles.git .
-
Create and edit your local configuration:
cp local.nix.example local.nix
Follow the personalization instructions above, but remember to use
/Users/your-usernameinstead of/home/your-usernamefor thehomeDirectoryfield. -
Apply the configuration (use your specific architecture):
For Apple Silicon (M1/M2/M3/etc.):
home-manager switch --flake .#samuel@aarch64-darwinFor Intel Macs:
home-manager switch --flake .#samuel@x86_64-darwin
- Home directory: Use
/Users/usernameinstead of/home/username - System architecture: You must specify your architecture explicitly when switching:
- Apple Silicon:
@aarch64-darwin - Intel:
@x86_64-darwin
- Apple Silicon:
- Docker: Install Docker Desktop separately from the official website. The
dockerpackage in Nix is just the CLI - nix-darwin: Not required for this configuration. Home Manager is sufficient for managing user-level dotfiles
After the initial setup, updates work the same way:
cd ~/.config/home-manager
git pull
# Use your specific architecture:
home-manager switch --flake .#samuel@aarch64-darwin # Apple Silicon
# or
home-manager switch --flake .#samuel@x86_64-darwin # Intel