nix-build-optimization

Optimize Nix build times by splitting derivations and integrating caching.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/aitchwhy/dotfiles --skill nix-build-optimization
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: nix-build-optimization
Source: https://github.com/aitchwhy/dotfiles/tree/main/config/agents/skills/nix-build-optimization
Command: npx skills add https://github.com/aitchwhy/dotfiles --skill nix-build-optimization

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Slow Nix builds and frequent CI/CD cache misses can severely hinder development velocity. This Skill provides fundamental patterns to optimize build times, ensure efficient caching, and streamline your CI/CD pipeline for any TypeScript/Nix project.

Core Features & Use Cases

  • Derivation Splitting: Separates stable inputs (dependencies) from volatile inputs (source code) to maximize cache hits and reduce rebuild times.
  • Multi-Layer Caching: Leverages Cachix (remote binary cache), Magic Nix Cache (GitHub Actions store persistence), and package manager caches for comprehensive optimization.
  • CI/CD Integration: Provides GitHub Actions patterns for fast, reliable Nix builds and container image creation with nix2container, ensuring consistent and rapid deployments.
  • Use Case: A developer is experiencing 25-minute CI/CD builds for a TypeScript/Nix project. They can use this skill to refactor their flake.nix to split derivations and integrate caching, reducing warm build times to under 2 minutes.

Quick Start

Analyze the 'flake.nix' file in the current repository and apply derivation splitting to optimize build times for a TypeScript/Bun project.