using-flake-parts

Convert Nix flakes to modular flake-parts structures with perSystem outputs.

1|Updated Oct 23, 2021
One-click install
npx skills add https://github.com/Omegaice/dotfiles --skill using-flake-parts
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: using-flake-parts
Source: https://github.com/Omegaice/dotfiles/tree/main/.claude/skills/using-flake-parts
Command: npx skills add https://github.com/Omegaice/dotfiles --skill using-flake-parts

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Nix flakes can become complex and boilerplate-heavy, especially when managing configurations across multiple systems. This Skill provides expert guidance on the flake-parts framework, simplifying modular organization, reducing duplication, and automating multi-system builds.

Core Features & Use Cases

  • Modular Flake Organization: Structure your Nix flakes with flake-parts for clarity, reusability, and maintainability, eliminating common boilerplate.
  • Automated Multi-System Builds: Define packages, development shells, and applications once in perSystem, and flake-parts automatically generates them for all specified target architectures.
  • Simplified Overlay Management: Leverage the easyOverlay module to automatically generate Nixpkgs overlays from your perSystem packages, ensuring proper dependency resolution.
  • Use Case: Convert a large, manually managed Nix flake into a modular flake-parts structure. This allows you to define a new package once, and have it automatically built and available for both your x86_64-linux desktop and aarch64-linux server, saving significant configuration time.

Quick Start

Explain how to convert a standard Nix flake to use the flake-parts framework, focusing on moving packages and devShells into perSystem.

Frequently Asked Questions about using-flake-parts

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I convert a standard Nix flake to use flake-parts?

Converting to flake-parts involves moving your packages and devShells into perSystem blocks, which automatically generates outputs for all specified target systems. Define each package once in perSystem, and flake-parts handles multi-system builds without duplicating configuration.

What is flake-parts and why should I use it for multi-system Nix builds?

Flake-parts is a framework that simplifies organizing complex Nix flakes by reducing boilerplate and enabling modular configuration. It automatically builds packages for multiple architectures like x86_64-linux and aarch64-linux from a single definition, eliminating manual duplication.

How does the easyOverlay module work in flake-parts?

The easyOverlay module automatically generates Nixpkgs overlays from your perSystem packages, ensuring proper dependency resolution across systems. This eliminates manual overlay management and keeps package definitions synchronized.

Can I use flake-parts to organize modular configurations across multiple Nix systems?

Yes. Flake-parts provides reusable flakeModules and mkFlake composition to structure modular configurations. You can organize overlays, partitions, and multi-system deployments while maintaining clarity and reducing configuration duplication.

What prior knowledge do I need to work with flake-parts?

Familiarity with Nix flakes, perSystem outputs, and basic Nixos configuration is required. Understanding of module arguments, importApply semantics, and standard flake structure helps you leverage flake-parts' modular features effectively.

How do I debug flake-parts configurations when builds fail?

Flake-parts includes debug mode to troubleshoot perSystem outputs, mkFlake composition, and module argument resolution. Use this to identify issues with partition organization or overlay dependencies before deployment.