···200200The following are default `meta.*` attributes defined by Den:
201201202202```nix
203203-aspect.name # "den.aspects.igloo"
204204-meta.loc # the location [ "den" "aspects" "igloo" ] from where name is derived.
205205-meta.file # the first file where this aspect was defined.
206206-meta.self # a reference to the aspect module `config`.
203203+aspect.name # "igloo", the submodule name
204204+aspect.meta.loc # the location [ "den" "aspects" "igloo" ] from where name is derived.
205205+aspect.meta.name # "den.aspects.igloo" derived from loc
206206+aspect.meta.file # the last file where this aspect was defined.
207207+aspect.meta.self # a reference to the aspect module `config`.
207208```
208209209210You can acess meta values by referencing an aspect:
+1-1
docs/src/content/docs/reference/lib.mdx
···146146147147## `den.lib.aspects`
148148149149-Den aspects API. Provides `resolve`, and aspect type definitions.
149149+Den aspects API. Provides aspect type definitions, `resolve`, `resolve.withAdapter` and basic `adapters`
+52
nix/lib/aspects/adapters.nix
···11+# Adapters for resolve.withAdapter. Default one is module.
22+#
33+# These adapters determine the return value of resolve. The adapters
44+# are called by resolve for each resolved aspect, and the adapter can choose
55+# to recurse or to replace which aspects will be used.
66+#
77+# Only basic adapters are provided here, see the arguments given by resolve.nix to them.
88+# Some adapters compose by taking other adapters as parameters.
99+{ lib, ... }:
1010+let
1111+1212+ # Default adapter imports all classModules on a single module and recurses on includes unconditonally.
1313+ module =
1414+ {
1515+ classModule,
1616+ recurse,
1717+ aspect,
1818+ ...
1919+ }:
2020+ {
2121+ imports = classModule ++ (lib.concatMap (i: (recurse i).imports or [ ]) (aspect.includes or [ ]));
2222+ };
2323+2424+ filter =
2525+ pred: adapter: args:
2626+ if pred args.aspect then adapter args else { };
2727+2828+ # transforms the result of other adapters using f.
2929+ map =
3030+ f: adapter: args:
3131+ f (adapter args);
3232+3333+ # transform each aspect into another by applying f to it.
3434+ mapAspect =
3535+ f: adapter: args:
3636+ adapter (args // { aspect = f args.aspect; });
3737+3838+ # transforms aspect includes by applying f to it.
3939+ mapIncludes =
4040+ f: adapter: args:
4141+ adapter (args // { recurse = included: args.recurse (f included); });
4242+4343+in
4444+{
4545+ inherit
4646+ module
4747+ filter
4848+ map
4949+ mapAspect
5050+ mapIncludes
5151+ ;
5252+}