Skip to content

airone01/flake

Repository files navigation

airone01/flake

A modular and extensible NixOS configuration system using a custom star-based architecture. This repository contains my personal NixOS configurations for multiple machines and deployments, managed with a comprehensive task runner.

πŸ“š Table of Contents

✨ Features

  • 🌟 Modular "star" system for composable configurations
  • πŸ› οΈ Comprehensive task runner using Just
  • πŸ”’ Secret management with sops-nix
  • πŸš€ Development shells for various tasks
  • πŸ“¦ Multiple machine configurations
  • πŸ”„ Automated formatting and checks
  • πŸ’Ύ ISO generation capabilities
  • πŸ“ Direnv support

πŸ—οΈ Structure

.
β”œβ”€β”€ asterisms/        # High-level configuration combinations
β”œβ”€β”€ constellations/   # Machine-specific configurations
β”‚   β”œβ”€β”€ aquarius/    # Server configuration
β”‚   β”œβ”€β”€ cassiopeia/  # Desktop configuration
β”‚   └── ursamajor/   # ISO configuration
β”œβ”€β”€ lib/             # Helper functions and core modules
β”œβ”€β”€ rockets/         # Development shells
β”œβ”€β”€ secrets/         # Encrypted secrets (using sops-nix)
└── stars/           # Modular configuration units

Key Components

  • Stars: Individual configuration modules that can be composed together
  • Asterisms: Predefined combinations of stars for specific use cases
  • Constellations: Complete system configurations for specific machines
  • Rockets: Development environments for specific tasks
  • Secrets: Encrypted configuration secrets managed with sops-nix

πŸš€ Getting Started

Prerequisites

  • NixOS or Nix with flakes enabled
  • Git
  • just command runner
  • (Optional) sops for secret management

Installation

  1. Install the just command runner:
nix-env -iA nixpkgs.just
  1. Bootstrap a new system:
just bootstrap <hostname>

This will:

  • Set up the nix channels
  • Install required tools
  • Clone the repository
  • Prepare the system for configuration
  1. Generate SOPS key (if using secrets):
just sops-key
  1. Review and modify the configuration:

    • Choose or create a constellation in constellations/
    • Modify flake.nix to include your system
    • Adjust hardware configuration as needed
  2. Deploy the configuration:

just switch <hostname>

πŸ› οΈ Usage

System Management

# Build and switch to configuration
just switch <hostname>

# Test configuration without applying
just test <hostname>

# Build ISO image
just iso [system] [format]

# Clean old generations
just clean [days]

Development Tasks

# Format nix files
just fmt

# Check formatting
just fmt-check

# Run flake checks
just check

# Enter development shell
just develop [shell-name]

# Show changes to nix files
just show-diff

Update Management

# Update all flake inputs
just update

# Update specific input
just update-input <input-name>

Available Development Shells

  • commitlint: For commit message linting
  • default: Contains tools to program in this repo

πŸ›οΈ Architecture

The Star System

Stars are the fundamental building blocks of this configuration. Each star is a self-contained NixOS module that can be composed with others.

# Example star structure
stars/
β”œβ”€β”€ gui/             # GUI-related configurations
β”‚   β”œβ”€β”€ gnome.nix
β”‚   └── hyprland.nix
β”œβ”€β”€ cli/             # CLI tool configurations
β”‚   └── nvim/
└── core/            # Core system configurations
    └── sound.nix

Flake Structure

The flake.nix provides:

  • nixosConfigurations: System configurations for each machine
  • packages: Installable packages and ISO images
  • devShells: Development environments

Secret Management

Secrets are managed using sops-nix with age encryption:

  • Secrets are stored in secrets/
  • Keys are configured in .sops.yaml
  • Each constellation can access only its required secrets
  • Generate keys with just sops-key

πŸ“¦ Machines

aquarius

  • Status: Abandonned

cassiopeia

  • Purpose: Desktop workstation
  • Features: GNOME desktop, development tools
  • Status: Active

cetus

  • Purpose: Home server
  • Services: Traefik, planned hosting for various services
  • Status: Active

ursamajor

  • Purpose: Installation ISO
  • Features: Basic system for testing and installation
  • Status: In Development

Commit Message Convention

This repository uses conventional commits. Each commit message should be structured as:

<type>(<scope>)[!]: <description>

[body]

[BREAKING CHANGE: ][footer]

Types: feat, fix, docs, style, refactor, perf, test, build, ci, chore Scopes: See .commitlintrc.yml for valid scopes

πŸ“‹ Roadmap

Category Task Priority Status
Documentation Add installation guides for each constellation High 🟑 Pending
Testing Add GitHub Actions workflows High 🟒 Complete
Testing Implement basic system tests Medium πŸ”΄ Not Started
Testing Add Nix formatting checks High 🟒 Complete
Security Implement firewall configuration High πŸ”΄ Not Started
Security Add fail2ban configuration Medium πŸ”΄ Not Started
Security Configure automatic security updates High πŸ”΄ Not Started
Security Implement SSH hardening High πŸ”΄ Not Started
Backup Add restic/borgbackup configuration High πŸ”΄ Not Started
Monitoring Set up Prometheus + Grafana Medium πŸ”΄ Not Started
Infrastructure Add Hydra instance Low 🟒 Complete
Infrastructure Add TeamCity instance Low πŸ”΄ Not Started
Infrastructure Add Attic binary cache Medium πŸ”΄ Not Started
Infrastructure Add Mastodon frontend Low 🟒 Complete
Infrastructure Add Lemmy instance Low πŸ”΄ Not Started
Infrastructure Add Invidious instance Low πŸ”΄ Not Started
Infrastructure Add SearXNG instance Medium πŸ”΄ Not Started
Infrastructure Add Gitea instance Medium 🟒 Complete
Infrastructure Add Jellyfin instance Low πŸ”΄ Not Started
Infrastructure Add Vaultwarden instance Low πŸ”΄ Not Started
Infrastructure Add Home Assistant instance Low πŸ”΄ Not Started
Infrastructure Add Paperless-ngx instance Low πŸ”΄ Not Started
Infrastructure Add Syncthing instance Low πŸ”΄ Not Started
Infrastructure Add Calibre-Web instance Low πŸ”΄ Not Started
Infrastructure Add Photoprism instance Low πŸ”΄ Not Started
Architecture Task runner implementation High 🟒 Complete
Architecture Figuring all of this out High 🟣 Always going on

Legend:

  • 🟒 Complete
  • 🟑 In Progress/Partial
  • πŸ”΄ Not Started
  • 🟣 Special

πŸ“„ License

This project is open source and available under the Apache v2 license.

πŸ™ Acknowledgments

  • NixOS for the amazing Linux distribution
  • All the fantastic Nix community members who share their configurations
  • NotAShelf for inspiration
  • casey/just for the fantastic command runner
  • Contributors to all the tools and packages used in this configuration