···30303131```nix "homeManager" "hjem" "maid" "x86_64-linux"
3232den.hosts.x86_64-linux.igloo.users = {
3333- tux = {
3333+ tux = {
3434 classes = [ "homeManager" "hjem" ];
3535 };
3636 pingu = {
···9191## Owned Configs
92929393Attributes named after a Nix class (`nixos`, `darwin`, `homeManager`, or any
9494-custom class) are referred by this documentation as **owned configs**.
9494+custom class) are referred by this documentation as **owned configs**.
95959696They are just a regular Nix module:
9797···134134being resolved and an `aspect-chain` that lead to the current aspect (most recent last).
135135136136137137-`(3)` is a more interesting kind of aspect that is used by Den to pass host/user defitions
137137+`(3)` is a more interesting kind of aspect that is used by Den to pass host/user defitions
138138into these functions, so they can inspect the host features and provide
139139configuration accordingly.
140140···186186stage. Use `den.lib.take.exactly` if a function should only run in specific contexts.
187187</Aside>
188188189189-190189## Aspect Meta-Data
191190192191Aspects have a `meta` submodule that can be used to attach meta-data
···207206aspect.meta.self # a reference to the aspect module `config`.
208207```
209208210210-You can acess meta values by referencing an aspect:
209209+You can access meta values by referencing an aspect:
211210212211```nix
213212den.aspects.igloo.meta.name
···216215Or if an aspect needs to access its own meta data as part of its parametric functor,
217216it can do something like:
218217219219-220218```nix
221221-den.aspects.foo =
219219+den.aspects.foo =
222220 { config, lib, ... }: # module args to access `config.meta`
223221 {
224222 meta.foo = "bar";
225225- __functor = self: ctx:
226226- if config.meta.foo == "bar"
223223+ __functor = self: ctx:
224224+ if config.meta.foo == "bar"
227225 then { } # do nothing, skip.
228226 {
229227 includes = filter (i: someCondition i) self.includes;
230228 };
231229 }
230230+```
232231232232+## Aspect Custom Submodule
233233+234234+In case an aspect needs a custom submodule, it can be added this way:
235235+236236+```nix
237237+den.aspects.tux =
238238+ { config, ... }: # The function-args style is required for `imports` not to be interpreted as an Aspect class.
239239+ {
240240+ imports = [
241241+ {
242242+ options = {
243243+ default-key = lib.mkOption {
244244+ type = with lib.types; str;
245245+ };
246246+ keygrip = lib.mkOption {
247247+ type = with lib.types; str;
248248+ };
249249+ };
250250+ }
251251+ ];
252252+253253+ default-key = "Hello World!";
254254+ keygrip = "Hello World!";
255255+}
233256```
234257258258+And then, you can refer to this custom submodule from other aspects:
235259260260+```nix
261261+{ den, ... }:
262262+{
263263+ den.aspects.igloo = {
264264+ homeManager =
265265+ { config, ... }:
266266+ {
267267+ programs = {
268268+ gpg = {
269269+ enable = true;
270270+ settings.default-key = den.aspects.${config.home.username}.default-key;
271271+ };
272272+ };
236273274274+ services = {
275275+ gpg-agent = {
276276+ enable = true;
277277+ enableSshSupport = true;
278278+ sshKeys = [
279279+ den.aspects.${config.home.username}.keygrip
280280+ ];
281281+ };
282282+ };
283283+ };
284284+ };
285285+}
286286+```