this post was submitted on 07 Oct 2025
21 points (100.0% liked)
Nix / NixOS
2492 readers
4 users here now
Main links
Videos
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
I haven't gotten much into flake-parts, but my understanding is that it creates a module system very similar to NixOS modules and Home Manager modules. Except that instead of defining a system configuration, flake-parts modules define flake outputs.
So I don't think you would use it in your NixOS configuration. If your configuration uses a flake there might be use cases for using it at the flake level. For example your flake defines a
nixosConfigurations
output, which is a set with an attribute for each host. If you had some unusually complicated code in that flake output you might use flake-parts to modularize it.Or I suppose flake-parts is largely aimed at simplifying per-system outputs like
packages
anddevShells
. Once again, if you wanted to split those definitions over multiple files flake-parts can do that. Or you can use it just to get flake-parts'eachDefaultSystem
helper if you don't want to use equivalent functionality from flake-utils, or the built-ingenAttrs
function.Although I love the NixOS module system, I haven't used flake-parts because I haven't had a case where I want reusable modules in the context of flake outputs. Usually my flakes are a pretty uncomplicated combination of
genAttrs
, basic devShells, basic overlays, and package expressions that I build withcallPackage
.