fake.modules transposition for aspect-oriented Dendritic Nix. with cross-aspect dependencies. Discussions: https://oeiuwq.zulipchat.com/join/nqp26cd4kngon6mo3ncgnuap/ dendrix.oeiuwq.com/Dendritic.html
dendritic nix aspect oriented
Nix 100.0%
13 3 4

Clone this repository

https://tangled.org/oeiuwq.com/flake-aspects https://tangled.org/did:plc:hwcqoy35x55nzde2sm6dbvq7/flake-aspects
git@knot.tangled.wizardry.systems:oeiuwq.com/flake-aspects git@knot.tangled.wizardry.systems:did:plc:hwcqoy35x55nzde2sm6dbvq7/flake-aspects

For self-hosted knots, clone URLs may differ based on your setup.

Download tar.gz
README.md

Nix Flake CI Status License

<aspect>.<class> transposition for Dendritic Nix#

flake.aspects
{
  foo = {
    nixos = ...;
  };
  bar = {
    nixos = ...;
    darwin = ...;
  };
  baz = {
    darwin = ...;
  };
}
image flake.modules
{
  nixos = {
    foo = ...;
    bar = ...;
  };
  darwin = {
    bar = ...;
    baz = ...;
  };
}

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.aspects transposes into flake.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