This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
This is a sophisticated NixOS/Home Manager dotfiles repository using the Denix framework for modular configuration management. It supports multiple platforms (NixOS, macOS via nix-darwin, Home Manager) with unified configuration.
All commands should be run using nix develop -c <command> to ensure the proper shell environment is loaded.
nix develop -c lint- Run linting tools (statix, deadnix, nix flake check) (if on nixos, should runnixos-rebuild build --flake .for better results)nix develop -c dx- Edit the flake.nix filenix fmt- Format code using treefmt (alejandra for Nix, rustfmt, black for Python)
- Individual program tests:
cd modules/programs/<program-name> && nix buildto test custom program builds - Convert_img tests:
cd modules/programs/convert_img && python -m pytest tests/
# macOS
darwin-rebuild switch --flake . --show-trace
# Linux (Home Manager only)
nix build .#homeConfigurations.x86_64-linux.activationPackage
# NixOS
sudo nixos-rebuild switch --flake .Create development shells with:
nix flake init -t github:connerohnesorge/dotfiles#<template-name>Available templates: devshell, rust-shell, go-shell, go-templ-shell, remix-js-shell, laravel-shell, phoenix-shell
nix flake check- Validate flake outputs and check for errorsnix eval .#nixosConfigurations.<hostname>.config.system.build.toplevel- Check NixOS configuration evaluationnix show-derivation- Inspect derivation details for debugging buildsnixos-rebuild build --flake . --show-trace- Build without switching to catch configuration errors
The repository uses the Denix framework for modular configuration management, providing type-safe, composable modules with automatic discovery and loading.
Configuration Modules (modules/config/):
constants.nix- Read-only user constants (username, email, etc.)user.nix- User account configuration for NixOS and Darwinhosts.nix- Host type definitions and feature mapping systemargs.nix- Shared arguments between nixos and home-manager configurationshome.nix- Home Manager configuration patternsrices.nix- Theme system configuration
Feature Modules (modules/features/):
- System-level capabilities that can be enabled per-host
- Use
delib.modulewithsingleEnableOption falsepattern - Platform-specific sections:
nixos.ifEnabled,darwin.ifEnabled,home.ifEnabled - Examples:
engineer.nix,hyprland.nix,nvidia.nix,audio.nix,bluetooth.nix
Custom Program Modules (modules/programs/):
- Self-contained applications with source code and build expressions
- Cross-platform deployment support (nixos/darwin)
- Examples:
catls/(Ruby),cmbd/(Go),convert_img/(Python),dx/(shell script)
Host Configurations (hosts/):
- Use
delib.hostwith type classification (desktop/laptop/server) - Feature enablement through
myconfig.features.* - Platform-specific configuration sections
Theme Configurations (rices/):
- Use
delib.ricewith Stylix integration - Consistent theming across applications using Base16 color schemes
Module Creation:
delib.module {
name = "feature-name";
options.myconfig.features.featureName = singleEnableOption false;
nixos.ifEnabled = { /* NixOS config */ };
darwin.ifEnabled = { /* macOS config */ };
home.ifEnabled = { /* Home Manager config */ };
}Host Configuration:
delib.host {
type = "desktop"; # or "laptop", "server"
features = { featureName = true; };
rice = "dark";
nixos = { /* NixOS-specific config */ };
darwin = { /* Darwin-specific config */ };
}Custom Program Packaging:
delib.module {
name = "program-name";
nixos.ifEnabled.environment.systemPackages = [ pkgs.program-name ];
darwin.ifEnabled.environment.systemPackages = [ pkgs.program-name ];
}The flake.nix uses Denix's auto-discovery system:
denix.lib.configurations {
homeManagerUser = "connerohnesorge";
paths = [./hosts ./modules ./rices]; # Auto-discovery paths
}This automatically creates:
nixosConfigurationshomeConfigurationsdarwinConfigurations
Features automatically enable required programs:
engineer.enable = true→ enables development tools (dx,md2pdf,convert_img, etc.)hyprland.enable = true→ enables Wayland desktop with supporting tools- Dependencies resolved through the Denix module system
Conditional Configuration: Separate platform sections in modules Shared Configuration: Maximize reuse between platforms where possible Platform Detection: Automatic handling of nixos vs darwin differences
flake.nix- Main entry point with system configurationsmodules/config/constants.nix- User constants (username, email, etc.)modules/config/hosts.nix- Host type definitions and feature mappingsshell.nix- Development environment with custom scripts
Creating New Feature Modules:
- Create a new
.nixfile inmodules/features/ - Use the
delib.modulepattern withsingleEnableOption false - Define platform-specific configuration in
nixos.ifEnabled,darwin.ifEnabled,home.ifEnabledsections - Features are automatically discovered and can be enabled in host configurations
Creating Custom Program Modules:
- Create a directory in
modules/programs/with source code anddefault.nix - Define the package derivation with cross-platform support
- Export the module using
delib.modulepattern - Programs are automatically available after rebuild
Modifying Host Configurations:
- Edit files in
hosts/to enable/disable features - Use
myconfig.features.featureName = trueto enable features - Platform-specific settings go in
nixosordarwinsections
- Module Isolation: Each module should be self-contained with minimal external dependencies
- Platform Awareness: Always consider both nixos and darwin when creating modules
- Feature Dependencies: Let the Denix system handle automatic dependency resolution
- Theme Integration: Use Stylix-compatible configuration for consistent theming
- Type Safety: Leverage Nix's type system through proper option definitions
Templates provide isolated development environments for different languages/frameworks:
- Each template is a complete flake.nix with development dependencies
- Use for project-specific development without affecting system configuration
- Available for: Go, Rust, Elixir/Phoenix, Laravel, Remix.js, Lua, and general devshell