Nix config for hackardoX
Welcome to my personal Nix configuration repository. This repository contains my nix-darwin configuration for macOS, built using flake-parts and following the dendritic pattern.
Before diving in, ensure that you have Nix installed on your system. If not, you can download and install it from the official Nix website or from the Determinate Systems installer.
# New machine without git
nix-shell -p git
# Clone
git clone https://github.com/hackardoX/nix.git
cd nix
# First run without nix-darwin:
nix run github:lnl7/nix-darwin#darwin-rebuild -- switch --flake github:hackardoX/nix
# or
nix build github:hackardoX/nix#darwinConfigurations.Andrea-MacBook-Air.system
sudo ./result/sw/bin/darwin-rebuild switch --flake .#Andrea-MacBook-Air
# Subsequent runs:
darwin-rebuild switch --flake .
# Or with nh (recommended):
nh darwin switchHere's an overview of what my Nix configuration offers:
-
Flake-parts Architecture: Modular flake structure using flake-parts for better composability and organization.
-
Dendritic Pattern: Configuration follows the dendritic pattern for a clean, modular structure.
-
External Dependency Integrations:
- Nixvim for Neovim configuration.
- Access the Nix User Repository (NUR) for additional packages and enhancements.
-
macOS Support: Seamlessly configure and manage Nix on macOS using nix-darwin.
-
Home Manager: Manage your dotfiles, home environment, and user-specific configurations with Home Manager.
-
DevShell Support: The flake provides a development shell for convenient development and maintenance of your Nix environment.
-
CI with Cachix: Continuous integration that pushes built artifacts to Cachix for efficient builds.
-
Secret Management: Secure handling of sensitive information with opnix.
This configuration uses flake-parts with the dendritic pattern for a modular and composable structure.
The dendritic pattern organizes Nix configurations into small, focused modules that compose together like dendrites in a neural network. Each module defines a specific piece of functionality and declares its dependencies explicitly.
Key benefits:
- Modularity: Each feature is isolated in its own module
- Composability: Modules combine freely and can be reused across configurations
- Clarity: Module relationships and dependencies are explicit and declarative
Learn more at the dendritic pattern documentation.
.
├── flake.nix # Main flake entry point
└── modules/
├── darwin/ # nix-darwin modules
├── homeManager/ # Home Manager modules
├── nixvim/ # Nixvim configuration
├── hosts/ # Host-specific configurations
└── ... # Additional feature modules
All modules are discovered recursively using
flake-parts' import-tree.
The modules/hosts/ directory contains host-specific configurations that select
which modules to enable for each machine.
Configuration is organized into focused modules by functionality (e.g., shell,
git, editor, fonts). Each host configuration in modules/hosts/ selects which
modules to enable and provides host-specific settings like username and system
version.
Configurations that inspired this setup:
- mightyiam/infra - Main inspiration for the dendritic pattern and flake-parts structure
- dustinlyons/nixos-config - Initial starting point
- khaneliman/khanelinix - Configuration inspiration