A Nix-based system and home configuration management setup for macOS and Linux environments.
This repository contains dotfiles and system configurations managed using Nix, Home Manager, and nix-darwin. It provides a declarative, reproducible approach to configuring systems and user environments across multiple machines.
I've evolved this setup across many years, taking the Nix-based approach since early 2024. The earliest iteration was a couple of files, and it's evolved quite a bit since then. I've used custom shell scripts, adopted a lot from Pivotal's workstation setup, and used Strap by @MikeMcquaid.
All along, this repo kept evolving but never quite satisfied me. It was too for configs to drift and to get annoyed something was missing. Once I started to adopt Nix, I realized I could get closer to the repeatable setup I was looking for---even if it is probably overkill for one person with a handful of machines to be so pedantic about keeping things consistent and automated..
Though most of that evolution, I needed to keep things private in spite of how much I ahem borrowed ahem from others' shared dotfiles. Once I added SOPS support into my Nix setup, I realized I could finally start sharing.
- Complete system configuration via Nix Flakes
- Support for both macOS (Darwin) and Linux (NixOS) systems
- Multiple user profiles with different configurations
- Secret management with sops-nix
- Comprehensive development environment setup
- Automated setup and management via Makefile
/hosts- Host-specific configurations for different systems/overlays- Nix overlays for package customization/pkgs- Custom package definitions/users- User-specific configuration files/files- Utility scripts and shared files/pki- Certificate files/work- Work-specific configurations
- Nix
- Flakes enabled
- Home Manager for user environment management
- nix-darwin (for macOS systems)
-
Install Nix:
sh <(curl -L https://nixos.org/nix/install) --daemon -
Enable flakes by creating or editing
~/.config/nix/nix.conf:experimental-features = nix-command flakes -
Clone this repository:
git clone https://github.com/yourusername/dotfiles.git ~/.dotfiles cd ~/.dotfiles
-
Install configurations based on your needs:
- For user configuration only:
make <username>
- For full system configuration:
make <hostname>
- For user configuration only:
Use the Makefile for common operations:
# Show available configurations
make show
# Apply current user's home configuration
make user
# Apply current host's system configuration
make host
# Update flake inputs
make update
# Check flake validity
make check
# Clean up [Nix](https://nixos.org) store
make cleanTo customize configurations:
- Create or modify host configurations in
/systems/hosts/<hostname>/ - Adjust user configurations in
/home/users/<username>/ - Add custom packages to
/pkgs/ - Create overlays in
/overlays/
See the flake.nix file for the main configuration structure.
Copyright (c) 2024 Chuck D'Antonio