Skip to content

flake-aspects

flake-aspects transposes <aspect>.<class> definitions into <class>.<aspect>, the standard flake.modules layout that lib.evalModules expects. On top of that, it provides a rich composition model:

  • Composable DAGs: aspects declare includes to form dependency graphs
  • Nestable sub-aspects: tree-structured aspects via provides / _, not flat string keys
  • Parametric providers: curried functions that produce aspects based on parameters
  • __functor pattern: override and customize any aspect
  • Cross-class forward: share configuration between NixOS, Darwin, Home-Manager, and any custom class
{
# An aspect that provides NixOS and Home-Manager configs
gaming = {
includes = [ base ]; # dependency, not a string reference
nixos = { pkgs, ... }: { environment.systemPackages = [ pkgs.steam ]; };
homeManager = { pkgs, ... }: { home.packages = [ pkgs.lutris ]; };
};
# Parametric: a function that returns an aspect
user-shell = shell: {
nixos = { pkgs, ... }: { users.users.default.shell = pkgs.${shell}; };
};
}
  • den, built entirely on flake-aspects for its aspect resolution
  • Independent users, some people use flake-aspects directly without den, building their own Aspect oriented setups
  • Mixable with existing non-aspect oriented infrastructure
Source Code Documentation Support this project