Add postprocessing, add flakeModules.touchup

This commit is contained in:
Robert Hensing 2025-05-27 14:32:12 +02:00
parent 157c95de4d
commit 9d0762c18a
7 changed files with 334 additions and 2 deletions

View file

@ -1,4 +1,4 @@
{ lib, ... }:
{ config, lib, options, ... }:
let
inherit (lib)
mkOption
@ -33,6 +33,27 @@ in
Raw flake output attributes. Any attribute can be set here, but some
attributes are represented by options, to provide appropriate
configuration merging.
Further processing may be applied to these attributes. See [`processedFlake`](flake-parts.md#opt-processedFlake) for more information.
'';
};
processedFlake = mkOption {
type = types.raw;
readOnly = true;
apply =
if options.processedFlake.isDefined
then x: x
else x: config.flake;
description = ''
The final flake output, as returned by `mkFlake`.
This separates two concerns:
- [`flake`](#opt-flake): the internal representation, where all attributes are available for use by other modules, regardless of whether they evaluate successfully for all configurations.
- `processedFlake`: the external output, which may have attributes removed or transformed to satisfy tools like `nix flake check`.
By default, `processedFlake` equals `flake` (no processing).
Import a module such as [`flakeModules.touchup`](#opt-touchup) to define it, or set it directly.
'';
};
};