Skip to content

aspauldingcode/.dotfiles

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🏠 Alex's Universal Dotfiles

A comprehensive, production-ready Nix configuration using flake-parts for managing NixOS, Darwin, and Home Manager configurations across multiple architectures and environments.

✨ Features

  • πŸ”§ Multi-Platform Support: macOS (Darwin), NixOS (x86_64 & aarch64), Mobile NixOS
  • πŸ—οΈ Modular Architecture: Clean separation using flake-parts
  • πŸ” Production-Ready Secrets: SOPS-nix with age encryption
  • πŸš€ Automated CI/CD: GitHub Actions with comprehensive checks
  • πŸ“± Mobile Support: OnePlus 6T with Mobile NixOS
  • 🎯 Environment Separation: Production, staging, development configurations
  • πŸ› οΈ Developer Experience: Rich development shells and tools

How much code?

πŸ‘¨β€πŸ’» Code Statistics:

Total LOC (including blanks, comments): 54873

πŸ” Click to expand code stats.
Language Files Lines Code Comments Blanks
CSS 8 5586 4248 316 1022
JSON 1 402 402 0 0
Lua 1 225 138 50 37
Markdown 13 3448 0 2476 972
Nix 286 39118 33000 3635 2483
Python 5 1617 1407 61 149
Shell 17 3936 2915 365 656
Plain Text 1 1 0 1 0
TOML 1 56 47 5 4
Vim script 0 0
YAML 9 484 304 160 20
Total 342 54873 42461 7069 5343

Last updated: Fri Aug 1 11:55:02 PDT 2025

πŸ–₯️ Supported Systems

System Architecture Hostname Status
macOS aarch64-darwin NIXY βœ… Active
macOS x86_64-darwin NIXI βœ… Active
NixOS Desktop x86_64-linux NIXSTATION64 βœ… Active
NixOS ARM aarch64-linux NIXY2 βœ… Active
Mobile NixOS aarch64-linux NIXEDUP (OnePlus 6T) πŸ§ͺ Experimental

πŸ—οΈ Repository Structure

This repository follows a standardized flake-parts structure for better organization and maintainability:

.
β”œβ”€β”€ flake.nix                 # Main flake entry point
β”œβ”€β”€ flake.lock               # Flake lock file
β”œβ”€β”€ parts/                   # Flake-parts modules
β”‚   β”œβ”€β”€ lib.nix             # Library functions
β”‚   β”œβ”€β”€ overlays.nix        # Nixpkgs overlays
β”‚   β”œβ”€β”€ sops.nix            # SOPS secrets management
β”‚   β”œβ”€β”€ common.nix          # Common configurations
β”‚   β”œβ”€β”€ nixos-configurations.nix
β”‚   β”œβ”€β”€ darwin-configurations.nix
β”‚   β”œβ”€β”€ home-configurations.nix
β”‚   β”œβ”€β”€ packages.nix        # Custom packages
β”‚   β”œβ”€β”€ apps.nix            # Flake applications
β”‚   β”œβ”€β”€ devshells.nix       # Development shells
β”‚   β”œβ”€β”€ docs.nix            # Documentation
β”‚   β”œβ”€β”€ ci.nix              # CI/CD scripts
β”‚   β”œβ”€β”€ formatter.nix       # Code formatting
β”‚   └── checks.nix          # Flake checks
β”œβ”€β”€ modules/                 # Reusable modules
β”‚   β”œβ”€β”€ nixos/              # NixOS modules
β”‚   β”œβ”€β”€ darwin/             # Darwin modules
β”‚   └── home-manager/       # Home Manager modules
β”œβ”€β”€ hosts/                   # System configurations
β”‚   β”œβ”€β”€ nixos/              # NixOS hosts
β”‚   β”‚   β”œβ”€β”€ NIXSTATION64/   # Desktop workstation
β”‚   β”‚   β”œβ”€β”€ NIXY2/          # ARM development board
β”‚   β”‚   └── NIXEDUP/        # OnePlus 6T mobile
β”‚   β”œβ”€β”€ darwin/             # Darwin hosts
β”‚   β”‚   └── NIXY/           # MacBook Pro M1
β”‚   └── extraConfig/        # SSH keys and additional configs
β”œβ”€β”€ profiles/                # Reusable configuration profiles
β”‚   β”œβ”€β”€ desktop/            # Desktop environment
β”‚   β”œβ”€β”€ server/             # Server configuration
β”‚   β”œβ”€β”€ mobile/             # Mobile optimizations
β”‚   └── development/        # Development tools
β”œβ”€β”€ users/                   # User-specific configurations
β”‚   β”œβ”€β”€ alex/               # Primary user
β”‚   └── susu/               # Secondary user
β”œβ”€β”€ secrets/                 # SOPS-encrypted secrets
β”‚   β”œβ”€β”€ production/         # Production environment
β”‚   β”œβ”€β”€ staging/            # Staging environment
β”‚   β”œβ”€β”€ development/        # Development environment
β”‚   β”œβ”€β”€ systems/            # System-specific secrets
β”‚   └── users/              # User-specific secrets
β”œβ”€β”€ scripts/                 # Management scripts
β”œβ”€β”€ docs/                   # Comprehensive documentation
β”œβ”€β”€ lib/                    # Helper functions
β”œβ”€β”€ overlays/               # Package overlays
β”œβ”€β”€ shared/                 # Shared configurations
└── tools/                  # Utility tools

πŸš€ Quick Start

Prerequisites

# Install Nix with flakes support
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install

# Clone the repository
git clone https://github.com/yourusername/dotfiles.git ~/.dotfiles
cd ~/.dotfiles

Building Systems

# NixOS systems
nix build .#nixosConfigurations.NIXSTATION64.config.system.build.toplevel
nix build .#nixosConfigurations.NIXY2.config.system.build.toplevel
nix build .#nixosConfigurations.NIXEDUP.config.system.build.toplevel

# Darwin systems
nix build .#darwinConfigurations.NIXY.system
nix build .#darwinConfigurations.NIXI.system

# Home Manager configurations
nix build .#homeConfigurations.alex.activationPackage

Deploying Systems

# NixOS (run on target system)
sudo nixos-rebuild switch --flake .#NIXSTATION64
sudo nixos-rebuild switch --flake .#NIXY2
sudo nixos-rebuild switch --flake .#NIXEDUP

# Darwin (run on macOS)
darwin-rebuild switch --flake .#NIXY
darwin-rebuild switch --flake .#NIXI

# Home Manager (run as user)
home-manager switch --flake .#alex

# Automated deployment (detects current system)
nix run .#ci-deploy

Development Workflow

# Enter development shell with all tools
nix develop

# Format code
nix fmt

# Check flake validity
nix flake check

# Run comprehensive CI checks
nix run .#ci-check

# Serve documentation locally
nix run .#docs-serve

πŸ“¦ Available Applications

Run applications with nix run .#<app-name>:

Application Description
default System information and flake overview
system-info Detailed system information
secrets-manager Interactive SOPS secrets management
mobile-installer Mobile NixOS installer for OnePlus 6T
update-readme Update README.md with current code statistics
ci-check Comprehensive CI/CD checks
ci-deploy Automated system deployment
docs-serve Local documentation server

Examples

# Get system information
nix run .#default

# Manage secrets interactively
nix run .#secrets-manager

# Update code statistics in README
nix run .#update-readme

# Run all CI checks
nix run .#ci-check

# Deploy current system
nix run .#ci-deploy

πŸ”§ Configuration Management

Adding a New Host

  1. Create host directory:

    mkdir -p hosts/{nixos,darwin}/hostname
  2. Create configuration:

    # hosts/nixos/hostname/default.nix
    { config, lib, pkgs, ... }: {
      imports = [
        ./hardware-configuration.nix
        ../../../profiles/desktop
      ];
      
      networking.hostName = "hostname";
      # Additional configuration...
    }
  3. Add to flake configuration:

    # parts/nixos-configurations.nix
    hostname = inputs.nixpkgs.lib.nixosSystem {
      # Configuration...
    };

Adding a New Module

  1. Create module:

    mkdir -p modules/{nixos,darwin,home-manager}/module-name
  2. Implement module:

    # modules/nixos/module-name/default.nix
    { config, lib, pkgs, ... }: {
      options = {
        # Module options...
      };
      
      config = {
        # Module implementation...
      };
    }
  3. Import in default.nix:

    # modules/nixos/default.nix
    {
      imports = [
        ./module-name
        # Other modules...
      ];
    }

Adding a New Profile

  1. Create profile directory:

    mkdir -p profiles/profile-name
  2. Define profile:

    # profiles/profile-name/default.nix
    { config, lib, pkgs, ... }: {
      imports = [
        # Required modules...
      ];
      
      # Profile configuration...
    }
  3. Import in profiles:

    # profiles/default.nix
    {
      profile-name = import ./profile-name;
    }

πŸ” Secrets Management

This configuration uses SOPS-nix with age encryption for production-ready secrets management:

Quick Commands

# Edit secrets (environment-specific)
sops secrets/production/secrets.yaml
sops secrets/development/secrets.yaml
sops secrets/users/alex.yaml

# Rekey secrets after adding new recipients
sops updatekeys secrets/production/secrets.yaml

# Interactive secrets management
nix run .#secrets-manager

# Validate all secrets
./scripts/secrets-manager.sh validate

# Audit secret access
./scripts/secrets-manager.sh audit

Environment Structure

  • Production: secrets/production/ - Live environment secrets
  • Staging: secrets/staging/ - Pre-production testing
  • Development: secrets/development/ - Local development
  • Users: secrets/users/ - Personal API keys and configs
  • Systems: secrets/systems/ - Host-specific secrets

Documentation

πŸ“š Documentation

Core Documentation

Quick Links

πŸ§ͺ Testing & Quality Assurance

Automated Testing

# Run all checks (recommended before commits)
nix flake check

# Test specific system builds (dry-run)
nix build .#nixosConfigurations.NIXSTATION64.config.system.build.toplevel --dry-run
nix build .#darwinConfigurations.NIXY.system --dry-run

# Format check
nix fmt --check

# Comprehensive CI checks
nix run .#ci-check

Manual Testing

# Test secrets decryption
./scripts/secrets-manager.sh validate

# Test system deployment (dry-run)
sudo nixos-rebuild dry-run --flake .#NIXSTATION64

# Test Home Manager configuration
home-manager build --flake .#alex

Continuous Integration

  • βœ… Flake validation: Ensures flake.nix is valid
  • βœ… Format checking: Code formatting with treefmt
  • βœ… Build testing: All system configurations build successfully
  • βœ… Secrets validation: All secrets can be decrypted
  • βœ… Documentation: Links and references are valid

πŸš€ Deployment

Automated Deployment

# Deploy current system automatically
nix run .#ci-deploy

Manual Deployment

# NixOS systems
sudo nixos-rebuild switch --flake .#NIXSTATION64

# Darwin systems
darwin-rebuild switch --flake .#NIXY

# Home Manager
home-manager switch --flake .#alex

Remote Deployment

# Deploy to remote NixOS system
nixos-rebuild switch --flake .#NIXSTATION64 --target-host user@hostname

# Deploy using deploy-rs (if configured)
deploy .#NIXSTATION64

πŸ› οΈ Development

Development Shell

# Enter development environment
nix develop

# Available tools in dev shell:
# - nix, nixpkgs-fmt, treefmt
# - sops, age, ssh-to-age
# - git, gh, pre-commit
# - mdbook (for documentation)

Code Formatting

# Format all code
nix fmt

# Check formatting
nix fmt --check

Pre-commit Hooks

# Install pre-commit hooks
pre-commit install

# Run hooks manually
pre-commit run --all-files

πŸ“± Mobile NixOS (Experimental)

This configuration includes experimental support for Mobile NixOS on OnePlus 6T:

# Build mobile image
nix build .#nixosConfigurations.NIXEDUP.config.system.build.android-bootimg

# Install mobile helper
nix run .#mobile-installer

# Flash to device (requires unlocked bootloader)
fastboot flash boot result/boot.img
fastboot reboot

Note: Mobile NixOS support is experimental and may require additional setup.

🀝 Contributing

We welcome contributions! Please see our Contributing Guidelines for details on:

  • Code style and formatting
  • Commit message conventions
  • Pull request process
  • Testing requirements
  • Documentation standards

Quick Contribution Workflow

  1. Fork and clone the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Make changes and test thoroughly
  4. Format code: nix fmt
  5. Run checks: nix flake check
  6. Commit changes: Follow conventional commit format
  7. Push and create a pull request

πŸ“„ License

This configuration is available under the MIT License. See LICENSE for details.

πŸ™ Acknowledgments


Made with ❀️ and Nix | Report Issues | Discussions

About

A Universal .dotfiles Configuration with Nix Flakes - over-engineered by Alex Spaulding.

Resources

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published