This repository contains my personal dotfiles for configuring my development environment on MacOS/ NixOS.
Note
Before applying the new configurations, it's a good idea to back up your existing dotfiles. You can do this by renaming them or moving them to a backup directory.
Before restoring the dotfiles, ensure you have the following installed:
-
Install Xcode Command Line Tools: Open your terminal and run:
xcode-select --install
-
Install Homebrew: Run the following command in your terminal:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" -
Install Nix: Use the following command to install Nix using the Determinate Systems installer for macOS (multi-user install):
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install
Check that your installation was successful by running:
nix --version
-
Bootstrap nix-darwin: After installing Nix, you can bootstrap nix-darwin by running the following commands:
mkdir -p ~/.config/nix/ cd ~/.config/nix/ nix flake init -t nix-darwin sed -i '' "s/simple/$(scutil --get LocalHostName)/" flake.nix
You will then need to add
nix.enable = false;to the~/.config/nix/flake.nixfile to allow nix-darwin to manage the Nix configuration.After that, you can run the following command to install nix-darwin:
sudo nix run nix-darwin --extra-experimental-features "nix-command flakes" -- switch --flake ~/.config/nix
Check to see that the installation was successful by running:
type darwin-rebuild
-
Clone the repository:
git clone --depth 1 https://github.com/francojc/dotfiles.git ~/.dotfiles -
Navigate to the dotfiles directory:
cd ~/.dotfiles
-
Remove any existing files that may conflict with the configurations:
rm -rf ~/.zshrc ~/.zshenv ~/.zsh ~/.config/nix
-
Make sure the
flake.nixhostname to match the system hostname:To find the hostname, run the following command:
hostname
[!NOTE] You can update the hostname in macOS running
sudo scutil --set LocalHostName <new-hostname>. I've also found that runningsudo hostname -s <new-hostname>can help in some cases. -
Apply the configurations using the full path to the flake's directory:
NIXPKGS_ALLOW_UNFREE=1 darwin-rebuild switch --flake ~/.dotfiles/.config/nix/#<yourhostname> --impure
Note: After a successful switch, you will be able to use the alias
switchto apply the configurations in the future. -
Use
stowto symlink the configurations:cd ~/.dotfiles stow .
This repository supports NixOS systems with a modular configuration system and flexible desktop environment profiles that mirror the macOS setup approach.
This dotfiles repository includes a NixOS host example with a modular desktop environment system:
- Desktop Environment: i3 (X11 window manager)
- Applications: Traditional Linux desktop applications
- Features: XRDP remote desktop support, X11 compatibility
- Best for: Servers, older hardware, remote access scenarios, Mac Mini 2011
Note
This configuration uses a modular profile system with separate desktop environment configurations in profiles/nixos/
Before setting up the NixOS configuration, ensure you have the following:
-
NixOS Installation: A working NixOS system (minimal installation is sufficient)
-
Flakes Support: Enable experimental features by adding to
/etc/nixos/configuration.nix:nix.settings.experimental-features = [ "nix-command" "flakes" ];
Then rebuild:
sudo nixos-rebuild switch -
Git: Install Git if not already available:
nix-shell -p git
-
Clone the repository:
git clone --depth 1 https://github.com/francojc/dotfiles.git ~/.dotfiles -
Navigate to the dotfiles directory:
cd ~/.dotfiles
-
Choose your host configuration approach:
You can either use one of the existing host configurations or create a new one.
4a. Review available configurations:
- Current example:
Mini-Roverhost configuration (i3/X11 setup) - Desktop environment profiles available:
sway.nix(Wayland) andi3.nix(X11)
5a. Update host configuration (optional):
Edit .config/nix/hosts/Mini-Rover/default.nix to customize:
nano .config/nix/hosts/Mini-Rover/default.nixUpdate the username and email:
username = "yourusername";
useremail = "your.email@example.com";4b. Generate hardware configuration:
sudo nixos-generate-config --show-hardware-config > .config/nix/hosts/$(hostname)/hardware-configuration.nix5b. Create host directory and configuration:
mkdir -p .config/nix/hosts/$(hostname)Create .config/nix/hosts/$(hostname)/default.nix based on one of the existing examples.
6b. Update the flake.nix:
Add your hostname to the hosts configuration in .config/nix/flake.nix:
hosts = {
"Macbook-Airborne" = import ./hosts/Macbook-Airborne/default.nix;
"Mac-Minicore" = import ./hosts/Mac-Minicore/default.nix;
"Mini-Rover" = import ./hosts/Mini-Rover/default.nix;
"yourhostname" = import ./hosts/yourhostname/default.nix; # Add this line
};-
Build and apply the NixOS configuration:
sudo nixos-rebuild switch --flake ~/.dotfiles/.config/nix/#yourhostname
Replace
yourhostnamewith:Mini-Roverfor the existing i3/X11 setup- Your custom hostname if you created a new configuration
[!NOTE] The first build may take longer as it downloads and builds all required packages.
-
Apply dotfiles symlinks:
cd ~/.dotfiles stow .
For i3 (Mini-Rover host):
- i3 will be available in your display manager
- XRDP is configured for remote desktop access (port 3389)
- Traditional X11 applications are prioritized
- LightDM display manager included
For Sway (if using sway.nix profile):
- Sway will be available in your display manager
- Waybar and Wofi are pre-configured
- Wayland-compatible applications and XDG portals included
NixOS uses Flatpak instead of Homebrew for GUI applications:
- Flatpak is automatically configured and enabled
- Pre-configured remotes include Flathub and Flathub Beta
- Applications are managed through the nix configuration in
modules/nixos/apps.nix
Note
The configuration now uses a modular profile system. Desktop environments are defined in profiles/nixos/ with sway.nix for Wayland and i3.nix for X11 setups.
Theme Configuration:
The system uses the theme specified in your host configuration. Available themes:
gruvbox(default)nightfoxarthuronedark
Adding Packages:
- System packages: Edit
modules/nixos/apps.nix - User packages: Edit appropriate files in
home/ - Flatpak packages: Add to the packages list in
modules/nixos/apps.nix
To update your system configuration:
cd ~/.dotfiles
git pull
sudo nixos-rebuild switch --flake .config/nix/#yourhostnameTo update packages:
cd ~/.dotfiles/.config/nix
nix flake update
sudo nixos-rebuild switch --flake ./#yourhostnameConfiguration fails to build:
- Check that your hostname matches the configuration name exactly
- Verify that hardware-configuration.nix exists and is properly formatted
- Ensure experimental features are enabled
Missing hardware-configuration.nix:
sudo nixos-generate-config --show-hardware-config > .config/nix/hosts/yourhostname/hardware-configuration.nixPermission issues:
Ensure you're using sudo for nixos-rebuild commands and your user is in the wheel group.
- Package Management: Flatpak replaces Homebrew for GUI applications
- Window Managers: Sway (Wayland) or i3 (X11) instead of macOS window management
- Home Directory:
/home/usernameinstead of/Users/username - Build Command:
nixos-rebuild switchinstead ofdarwin-rebuild switch - Modules: Uses
nixosModulesinstead ofdarwinModules