How sam-mahoney/nix works
Main Components
• flake.nix (Entrypoint): This file is the single source of truth that ties together all the configurations, inputs, and outputs (for NixOS, nix-darwin, and Home Manager). It sets up the relationships to the other parts of the project.
• machines/ Directory: Contains machine-specific configuration directories (for “halcyon” and “helios”). Each machine dimension directory includes its own default.nix file which serves as the entrypoint for that machine’s configuration.
• homemgr/ Directory: Holds Home Manager configurations. There are further subdirectories here that separate out components (like “mahoney” and then more subdivisions such as “halcyon” and “helios”) for specific machine or purpose targeting.
• modules/ Directory: This directory comprises reusable, platform-specific modules. It is organized into a couple of layers (common utilities, and programs–each with its own configuration such as for alacritty, bat, direnv, etc.). Each subdirectory typically includes a default.nix so that it can be imported as a module into the main configurations.
• overlays/ Directory: Contains Nix overlays to customize or extend functionality, following the same pattern (an entry file default.nix).
Relationships and Interactions
• The modules provide configurations for various programs (e.g., alacritty, neovim, git, tmux, etc.) and common scripts, which then are applied within situations like configuring terminals, shell environments, and development tools for the target machines.
Architectural Patterns and Design Principles
• Modularity: The project is highly modular, with a clear separation between machine-specific configurations, reusable modules, and overlays. Each directory with a default.nix acts as an entry point.
• Declarative Configuration: Leveraging Nix Flakes means that the entire configuration is declarative, ensuring reproducibility across systems.
• Separation of Concerns: The architecture separates system-level configurations (machines/) from user-level configurations (homemgr/) and reusable building blocks (modules/).
Relevant Technologies/Frameworks
• Nix/NixOS: As the foundation for system configuration.
• Nix Flakes: For managing reproducible and composable configurations.
• Home Manager: For configuring user-level settings (especially for nix-darwin and possibly NixOS).