Skip to content

flake-aspects

<aspect>.<class> transposition for Nix — dependency-free, composable, cross-class.

flake-aspects is a small, dependency-free Nix library that transposes <aspect>.<class> into <class>.<aspect> — the standard flake.modules layout.

On top of transposition, it provides a composable dependency graph via includes, nestable sub-aspects via provides (alias _), parametric curried providers, context-aware __functor override, and cross-class forward.

Zero dependencies

Pure Nix. Works with flakes, without flakes, with flake-parts, or standalone via lib.evalModules.

Any Nix class

NixOS, Darwin, Home-Manager, NixVim, Terranix — any configuration class expressible as a Nix module.

Composable graph

Aspects declare includes forming a dependency DAG. Resolution collects all class-specific configs transitively.

Parametric

Curried functions as providers. Pass arguments at inclusion time. Override behavior with __functor.

flake.aspects
{
vim-btw = {
nixos = { ... };
darwin = { ... };
homeManager = { ... };
};
tiling-desktop = {
includes = [ aspects.vim-btw ];
nixos = { ... };
};
}
# output: flake.modules (transposed + resolved)
{
nixos.vim-btw = { imports = [ ... ]; };
nixos.tiling-desktop = { imports = [ nixos-config, vim-btw-nixos ]; };
darwin.vim-btw = { imports = [ ... ]; };
homeManager.vim-btw = { imports = [ ... ]; };
}

Used by Den and others for dendritic Nix setups.

Contribute Community Sponsor