modular-flake/nix/output/lib.nix
2026-11-25 15:03:48 +01:00

33 lines
674 B
Nix

{ lib, ... }:
with lib;
{
config.outputKinds = [
(_: {
options = {
lib = mkOption {
type = with types; anything;
description = ''
Exported from the flake at `.lib` and `.lib.<system>` respectively.
Arbitrary shape. Intended for use in "library" flakes, exporting the Nix
expressions.
'';
};
};
outputs =
{
config,
hasSystem,
system,
...
}:
if hasSystem then
{
lib.${system} = config.lib;
}
else
{
lib = config.lib;
};
})
];
}