What base modules provide
Base modules are automatically imported by both NixOS and Darwin modules. They handle platform differences internally, giving you a consistent configuration interface.Nix configuration
Nix daemon settings, binary caches, and experimental features
Package management
nixpkgs configuration and system-wide packages
User management
User accounts and SSH key configuration
System utilities
Common tools and system metadata
Module categories
nix/
Nix daemon and build system configuration.nix.nix - Nix daemon settings
nix.nix - Nix daemon settings
Core Nix daemon configuration that works on both NixOS and Darwin.Configures:
- Experimental features (flakes, nix-command)
- Build settings (cores, max-jobs)
- Auto-optimization and garbage collection
- Trusted users
- Sandbox settings
substituters.nix - Binary caches
substituters.nix - Binary caches
Configure binary cache servers for faster builds.Binary caches provide pre-built packages, dramatically reducing build times.
modules/base/nix/substituters.nix
plugins.nix - Nix plugins
plugins.nix - Nix plugins
Load Nix plugins to extend functionality.Plugins can add:
- Custom fetchers
- Additional built-in functions
- Integration with external systems
environment.nix - Nix environment
environment.nix - Nix environment
Environment variables for Nix operations.Sets:
NIX_PATHfor channel compatibility- Build environment variables
- Cache locations
system/
Core system configuration and metadata.revision.nix - System revision
revision.nix - System revision
Track the git revision of your configuration.Automatically embeds the current git commit hash into your system, making it easy to identify which configuration version is running.
vars.nix - System variables
vars.nix - System variables
System-wide variables and metadata.Defines:
- System name and hostname
- Machine type identifiers
- Custom system attributes
tools.nix - System tools
tools.nix - System tools
Essential command-line tools that should be available on every system.Includes:
- Core utilities (coreutils, findutils, diffutils)
- Network tools (curl, wget, rsync)
- Archive tools (tar, gzip, unzip)
- Text processing (grep, sed, awk)
fonts.nix - System fonts
fonts.nix - System fonts
Base font configuration shared across platforms.Ensures consistent fonts on both NixOS and Darwin.
users/
User account management.mkuser.nix - User creation helper
mkuser.nix - User creation helper
Functions to create user accounts consistently across platforms.Handles platform differences:
- NixOS uses
users.users - Darwin uses
users.userswith different options - Home Manager integration
isabel.nix - Example user
isabel.nix - Example user
Configuration for the primary user (Isabel).This configuration is automatically applied when the user “isabel” is added to
modules/base/users/isabel.nix
garden.system.users.options.nix - User options
options.nix - User options
Common user configuration options.Defines:
- Shell selection
- Home directory location
- User groups and permissions
- SSH key management
Top-level modules
nixpkgs.nix - nixpkgs configuration
nixpkgs.nix - nixpkgs configuration
Configure nixpkgs for building packages.This ensures:
- Unfree packages (like Discord, Spotify) can be installed
- Cross-compilation to unsupported systems is allowed
- Custom package overlays are applied consistently
programs.nix - Base programs
programs.nix - Base programs
Programs that should be available on every system.Includes:
- Git for version control
- Vim for quick edits
- Basic shell utilities
Usage example
Base modules are imported automatically - you don’t need to import them manually:Module inheritance
The module hierarchy flows like this:- Flake modules provide build system and development tools
- NixOS/Darwin modules provide platform-specific system configuration
- Base modules provide shared system configuration
- Home Manager modules provide user configuration
- Generic modules provide the most basic shared functionality
Key features
Platform abstraction
Base modules hide platform differences. When you configure Nix settings, the framework automatically applies them correctly on both NixOS and Darwin.Binary cache optimization
Configured binary caches mean you download pre-built packages instead of compiling from source:User management
User configuration is consistent across platforms. Define a user once, use it on both NixOS and Darwin:Nix flakes enabled
Base modules enable flakes and the new Nix CLI by default, giving you access to modern Nix features.Configuration best practices
Enable binary caches
Always configure binary caches to speed up builds:Allow unfree packages
Many useful packages require unfree licenses:Use auto-optimization
Save disk space by deduplicating the Nix store:Configure garbage collection
Automatically clean up old generations:Relationship to generic modules
Base modules import generic modules, which provide the most basic shared functionality:modules/base/default.nix
- Package installation options (
garden.packages) - Profile system (
garden.profiles) - Basic shared configuration
Next steps
Generic modules
The foundation that all other modules build on
NixOS modules
See how NixOS modules build on the base