Nix Config
A set of configs for my machines:
- powerhouse (desktop) - NixOS
- capacitor (server) - NixOS
- turbine (laptop) - macOS with nix-darwin
Features
- Modular Architecture: 17+ organized modules across 9 categories for maximum reusability
- Cross-platform: Supports both NixOS and macOS with shared configurations
- Home Manager integration: User-specific configs with modular component imports
- Unified GPG/SSH: Integrated authentication and encryption strategy
- Homebrew support (macOS): GUI applications and Mac-specific software
- Minimal approach: Prefer nixpkgs over Homebrew when possible
- Cross-compilation: Build and validate nix-darwin configs from Linux
Quick Start
Prerequisites
- Install Nix with flakes enabled
- Clone this repository
- Enter the development environment
Development Environment
# Enter development shell
nix develop
# View available commands
just help
Building Configurations
# Build NixOS VM
just build-linux
# Cross-compile nix-darwin config from Linux
just build-darwin
# Validate nix-darwin config (faster)
just check-darwin
Repository Structure
├── docs/ # Documentation
├── hosts/ # Host-specific configurations
│ ├── powerhouse/ # NixOS desktop
│ └── turbine/ # macOS laptop
├── modules/ # Modular components (17+ modules)
│ ├── desktop/ # Desktop environments (hyprland)
│ ├── fonts/ # Font configurations
│ ├── hardware/ # Hardware-specific modules (nvidia)
│ ├── network/ # Network configurations (wireguard)
│ ├── os/ # Operating system modules (common, darwin, nixos)
│ ├── programs/ # Application configurations (git)
│ ├── security/ # Security modules (gpg, ssh, gpg-agent)
│ ├── terminal/ # Terminal tools (nvim, starship, tmux, zsh)
│ └── virtualization/ # Virtualization tools (podman, qemu)
├── users/ # User-specific configurations
├── flake.nix # Main flake configuration
└── justfile # Development commands
Module Architecture
The configuration is built using a modular approach where each component serves a specific purpose:
OS Modules (modules/os/
)
common.nix
- Universal settings for all systemsnixos.nix
- NixOS-specific configurationsdarwin.nix
- macOS-specific configurations
User-specific Modules
modules/terminal/
- Shell, terminal emulators, and CLI toolsmodules/security/
- GPG, SSH, and authenticationmodules/programs/
- Application-specific configurations
System Modules
modules/hardware/
- Hardware-specific configurationsmodules/network/
- Network and VPN configurationsmodules/desktop/
- Desktop environment configurationsmodules/virtualization/
- Container and VM configurations
Configuration Import Strategy
Host Configurations (hosts/*/config.nix
):
imports = [
../../modules/os/common.nix # Universal settings
../../modules/os/nixos.nix # or darwin.nix for macOS
./hardware.nix # Host-specific hardware
];
User Configurations (users/*/home.nix
):
imports = [
../../modules/terminal/zsh.nix
../../modules/security/gpg.nix
../../modules/programs/git.nix
# Add modules as needed
];
Getting Help
- Check the documentation in the navigation menu
- Run
just help
for available commands - Review existing configurations in the hosts/ directory
- Explore modules in the modules/ directory for reusable components
- See module import examples in users/brancengregory/home.nix
- See GitHub Copilot Agent for development environment details
Adding New Modules
To add a new module:
- Create the module file in the appropriate
modules/
subdirectory - Follow the existing module structure and naming conventions
- Import the module in the relevant host or user configuration
- Test the configuration with
just check-darwin
orjust build-linux