Modular, context-aware and aspect-oriented dendritic Nix configurations. Discussions: https://oeiuwq.zulipchat.com/join/nqp26cd4kngon6mo3ncgnuap/ den.oeiuwq.com
configurations den dendritic nix aspect oriented

Rename `parametric.context` to `parametric.fixedTo` (#85)

to be more precise about it providing a fixed context to all its
included functions.

authored by oeiuwq.com and committed by

GitHub 74b6ece6 bab28b55

+12 -5
+2 -2
nix/lib.nix
··· 68 68 69 69 parametric.atLeast = funk (lib.flip take.atLeast); 70 70 parametric.exactly = funk (lib.flip take.exactly); 71 - parametric.context = lib.flip parametric.atLeast; 71 + parametric.fixedTo = lib.flip parametric.atLeast; 72 72 parametric.expands = attrs: funk (ctx: (lib.flip take.atLeast) (ctx // attrs)); 73 73 parametric.__functor = 74 74 self: ctx: ··· 79 79 else if isFn ctx then 80 80 funk ctx 81 81 else 82 - self.context ctx; 82 + self.fixedTo ctx; 83 83 84 84 aspects = inputs.flake-aspects.lib lib; 85 85
+10 -3
templates/default/modules/aspects/eg/routes.nix
··· 1 1 # This example implements an aspect "routing" pattern. 2 2 # 3 - # Unlike `den.default` which is `parametric.atLeast` we use `parametric.exactly` here 4 - # to be more strict and prevent multiple values inclusion. 3 + # Unlike `den.default` which is `parametric.atLeast` 4 + # we use `parametric.fixedTo` here, which help us 5 + # propagate an already computed context to all includes. 6 + # 7 + # This aspect, when installed in a `parametric.atLeast` 8 + # will just forward the same context. 9 + # The `mutual` helper returns an static configuration which 10 + # is ignored by parametric aspects, thus allowing 11 + # non-existing aspects to be just ignored. 5 12 # 6 13 # Be sure to read: https://vic.github.io/den/dependencies.html 7 14 # See usage at: defaults.nix, alice.nix, igloo.nix ··· 19 26 routes = 20 27 { host, user, ... }@ctx: 21 28 { 22 - __functor = parametric ctx; 29 + __functor = parametric.fixedTo ctx; 23 30 includes = [ 24 31 (mutual user host) 25 32 (mutual host user)