using-flake-parts

Structure multi-system Nix flakes with Flake-Parts modular imports and perSystem configurations.

16|1|Updated Apr 25, 2023
One-click install
npx skills add https://github.com/OJII3/dotfiles --skill using-flake-parts-ojii3
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: using-flake-parts
Source: https://github.com/OJII3/dotfiles/tree/main/modules/home/ai/skills/using-flake-parts
Command: npx skills add https://github.com/OJII3/dotfiles --skill using-flake-parts-ojii3

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill provides a guided approach to structuring multi-system Nix flakes with Flake-Parts, enabling modular configurations, reusability, and scalable management across diverse targets.

Core Features & Use Cases

  • Modular organization: Use imports, importApply, and reusable flakeModules to compose flakes cleanly.
  • PerSystem & allSystems: Manage multi-system outputs from a single configuration and access per-system data at the top level.
  • Overlays & easyOverlay: Leverage overlays for consistent dependency resolution across systems and shareable toolchains.
  • Best practices & dogfooding: Learn patterns to build reusable modules for internal use and for consumption by other flakes.

Quick Start

Set up a minimal flake-parts project, wrap outputs with mkFlake, declare multi-system systems, and add a simple perSystem block to expose one package.

Frequently Asked Questions about using-flake-parts

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

FAQPage Schema
How do I structure multi-system Nix flakes for scalable configuration?

Structure multi-system Nix flakes by using the Flake-Parts framework to modularize imports, manage perSystem configurations, and apply overlays. This enforces explicit module arguments and safe scoping for maintainable configurations across diverse targets.

What is the best way to manage per-system outputs in a Nix flake?

Manage per-system outputs in a Nix flake by utilizing Flake-Parts' perSystem and allSystems configurations. This allows you to define multi-system outputs from a single configuration and access per-system data directly at the top level.

How do importApply and reusable flakeModules work in Flake-Parts?

importApply and reusable flakeModules in Flake-Parts work by allowing you to compose flakes cleanly through modular imports. This pattern enables safe scoping and building reusable modules for both internal use and consumption by external flakes.

Can I use overlays to share toolchains across multiple systems in Nix?

Yes, you can use overlays and the easyOverlay feature in Flake-Parts to ensure consistent dependency resolution across multiple systems. This approach enables shareable toolchains and scalable management of complex Nix configurations.

Do I need Flake-Parts to build maintainable Nix configurations across diverse targets?

Flake-Parts is highly recommended for building maintainable Nix configurations across diverse targets because it enforces explicit module arguments, safe scoping, and documented modular patterns that scale effectively for complex multi-system setups.