lib/types: add docs for custom type

This commit is contained in:
Johannes Kirschbauer
2025-09-17 11:03:08 +02:00
parent 80bc3daf96
commit 7a38e976a4

View File

@@ -1,8 +1,19 @@
{ lib, ... }: { lib, ... }:
{ {
/**
A custom type for deferred modules that guarantee to be JSON serializable.
This type guarantees that the module is serializable by checking all definitions.
Nix doesn't allow to raise a nice error if the module is not serializable.
It applies the following restrictions:
- Enforces that there is only one definition.
- Enforces that the definition is JSON serializable
- Disallows nested imports
*/
uniqueDeferredSerializableModule = lib.fix ( uniqueDeferredSerializableModule = lib.fix (
self: self:
let let
checkDef = checkDef =
_loc: def: _loc: def: