This repository contains my personal dotfiles and system configuration for setting up a macOS system using the Nix package manager and the nix-darwin
framework. The configuration is defined using a flake-based approach, allowing for reproducible and declarative system configuration.
- Prerequisites
- Installation
- Flake Structure
- Home Manager Configuration
- Darwin Configuration
- Common Configuration
- Variables
- Additional Configuration
- Makefile Usage
- Customization
- Troubleshooting
- Contributing
- Acknowledgements
- License
Before using this configuration, ensure that you have the following prerequisites:
- macOS system (tested on aarch64 architecture)
- Command Line Tools for Xcode installed
- Basic understanding of Nix and NixOS configuration
To install and use this configuration, follow these steps:
-
Install Command Line Tools for Xcode:
xcode-select --install
-
Install Nix using the Determinate Systems installer:
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install
For more information on the Determinate Systems Nix installer, refer to the following resources:
-
Clone this repository to your local machine:
git clone https://github.com/sbarrios93/config.git
-
Navigate to the cloned repository:
cd config
-
Run the deployment command using the provided Makefile:
make deploy
This command will build and switch to the NixOS configuration defined in the flake.
-
After the deployment is complete, reboot your system to ensure all changes take effect.
The flake structure of this configuration is as follows:
flake.nix
: The main flake file that defines the inputs, outputs, and configurations.home/
: Directory containing the Home Manager configuration files.darwin/
: Home Manager configuration specific to macOS.base/
: Common Home Manager configuration shared across systems.
darwin/
: Directory containing the Darwin (macOS) system configuration files.common/
: Directory containing common configuration files shared across systems.hosts/
: Directory containing host-specific configuration files.darwin/
: Configuration specific to macOS hosts.
vars/
: Directory containing variable definitions used in the configuration.config/
: Directory containing additional configuration files.
The Home Manager configuration is defined in the home/
directory. It includes configuration files for various user-specific settings and dotfiles.
The home/darwin/
directory contains Home Manager configuration specific to macOS. It includes:
files.nix
: Configuration for syncing dotfiles and configuration files.home.nix
: Home Manager configuration for the user's home directory.packages.nix
: Configuration for installing packages specific to macOS.modules/
: Directory for additional Home Manager modules.
The home/base/
directory contains common Home Manager configuration shared across systems. It includes:
bat.nix
: Configuration for thebat
command-line tool.eza.nix
: Configuration for theeza
command-line tool.fonts.nix
: Configuration for installing and managing fonts.fzf.nix
: Configuration for thefzf
command-line fuzzy finder.git.nix
: Configuration for Git version control system.home.nix
: Common Home Manager configuration for the user's home directory.packages.nix
: Configuration for installing common packages.starship.nix
: Configuration for the Starship prompt.tmux.nix
: Configuration for thetmux
terminal multiplexer.zoxide.nix
: Configuration for thezoxide
directory jumper.zsh.nix
: Configuration for the Zsh shell.
The Darwin (macOS) system configuration is defined in the darwin/
directory. It includes various system-level settings and preferences specific to macOS.
The darwin/system.nix
file contains system-wide settings and preferences, such as enabling the Nix daemon and configuring the Zsh shell.
The darwin/finder.nix
file contains settings for the Finder application, such as showing hidden files and setting the default view style.
The darwin/dock/
directory contains configuration files for managing the macOS Dock. It includes:
config.nix
: Configuration options for the Dock.default.nix
: Main configuration file for the Dock.
The darwin/homebrew/
directory contains configuration files for integrating Homebrew package management with Nix. It includes:
casks
: List of Homebrew casks to install, depending on the environment:personal
orwork
default.nix
: Main configuration file for Homebrew integration.
The common/
directory contains configuration files that are shared across different systems. It includes:
home.nix
: Common Home Manager configuration.nix.nix
: Configuration for Nix package manager.version.nix
: Configuration for system versioning.
The vars/
directory contains variable definitions used in the configuration. It includes:
default.nix
: Main variable definition file.users/default.nix
: User-specific variable definitions.environments/default.nix
: Defines if the environment ispersonal
orwork
The config/
directory contains additional configuration files, such as aliases and environment settings for the Zsh shell.
The provided Makefile offers convenient commands for managing the NixOS configuration:
make deploy
: Deploys the NixOS configuration by building and switching to the defined configuration.make deploy-work
: Runs theswitch-environment.sh
script, sets thevars/environments/default.nix
environment towork
and runsmake deploy
make deploy-personal
: Runs theswitch-environment.sh
script, sets thevars/environments/default.nix
environment topersonal
and runsmake deploy
make fmt
: Formats the Nix code usingnixfmt
.make lint
: Lints the Nix code usingnixfmt
anddeadnix
.make help
: Displays the available Makefile commands and their descriptions.
While this configuration is tailored to my personal preferences and setup, you can still use it as a starting point for your own configuration. Feel free to explore the files in the home/
, darwin/
, and common/
directories and adapt them tohttps://github.com/dustinlyons/nixos-config) suit your needs.
Remember to review the configuration files carefully and understand the implications of any changes you make.
If you encounter any issues while using this configuration, consider the following troubleshooting steps:
- Ensure that you have the latest version of Nix installed.
- Double-check that you have met all the prerequisites mentioned in the Prerequisites section.
- Review the configuration files for any syntax errors or conflicting settings.
- Consult the Nix and NixOS documentation for specific error messages or issues.
- Seek help from the Nix community or open an issue in this repository if you need further assistance.
While this configuration is primarily for my personal use, if you have any suggestions or improvements, feel free to open an issue or submit a pull request. I appreciate any feedback or ideas that can enhance my setup.
A lot of the inspiration for this configuration comes from the following sources:
This configuration is open-source and available under the MIT License. Feel free to use, modify, and distribute it as per the terms of the license.