<aspect>.<class> transposition for Dendritic Nix#
flake.aspects
|
|
flake.modules
|
Motivation#
On Dendritic setups it is common to expose modules using flake.modules.<class>.<aspect> - see aspect-oriented nix configurations.
However, for humans, it might be more intuitive to use a transposed attrset <aspect>.<class>. Because it feels more natural to nest classes on aspects than the other way around.
Usage#
As a deps-free library from ./default.nix:
let transpose = import ./default.nix { lib = pkgs.lib; }; in
transpose { a.b.c = 1; } # => { b.a.c = 1; }
As a Dendritic flake-parts module that provides the flake.aspects option:
flake.aspectstransposes intoflake.modules.
{ inputs, ... }: {
imports = [ inputs.flake-aspects.flakeModule ];
flake.aspects.sliding-desktop = {
nixos = { ... }; # configure Niri
darwin = { ... }; # configure Paneru
};
}
Testing#
nix run ./checkmate#fmt --override-input target .
nix flake check ./checkmate --override-input target . -L