API Reference
Entry points
Section titled “Entry points”The flake exposes three entry points:
{ # Default functor: (lib) → { transpose, types, aspects, new, new-scope, forward } __functor = _: import ./nix;
# flake-parts module: creates flake.aspects → flake.modules flakeModule = ./nix/flakeModule.nix;
# Library API: (lib) → { transpose, types, aspects, new, new-scope, forward } lib = import ./nix/lib.nix;}Usage: flake-aspects.lib nixpkgs.lib or import ./nix/lib.nix lib.
Exports
Section titled “Exports”Source: nix/lib.nix
transpose { emit? }
Section titled “transpose { emit? }”Source: nix/default.nix
Generic 2-level transposition. Returns a function attrs → transposed-attrs.
| Parameter | Type | Default | Purpose |
|---|---|---|---|
emit | { child, parent, value } → [{ parent, child, value }] | lib.singleton | Hook for filtering, modifying, or multiplying items |
See Transpose concept.
Source: nix/types.nix
Returns { aspectsType, aspectSubmodule, providerType }.
aspects
Section titled “aspects”Source: nix/aspects.nix
aspects : lib → aspectsConfig → { transposed }.
Aspect-aware transposition. Supplies a custom emit to transpose that calls resolve on each item. Returns { transposed = { <class>.<aspect> = resolved-module; }; }.
Source: nix/new.nix
new : lib → (option → transposed → moduleDefinition) → aspectsConfig → moduleDefinition.
Low-level scope factory. The callback receives:
option— anmkOptionforaspectsType(the user-facing input)transposed— the resolved{ <class>.<aspect> }output
new-scope
Section titled “new-scope”Source: nix/new-scope.nix
new-scope : name → nixos-module.
Creates ${name}.aspects (input) and ${name}.modules (read-only output). Sugar over new. See Standalone guide.
forward
Section titled “forward”Source: nix/forward.nix
forward : lib → { each, fromClass, intoClass, intoPath, fromAspect } → aspect.
Cross-class module forwarding. See Forward guide.
flakeModule
Section titled “flakeModule”Source: nix/flakeModule.nix
A flake-parts module. Import it to get flake.aspects (input) → flake.modules (output). Uses new internally. See flake-parts guide.