den - an aspect-oriented approach to Dendritic Nix configurations.#
den and vic's dendritic libs made for you with Love++ and AI--. If you like my work, consider sponsoring
Need more batteries? See vic/denful. Join the community discussion. Ask questions, share how you use |
🏠 Concise definitions of Hosts, Users and Standalone-Homes. See _types.nix for complete schema. 🧩 Aspect-oriented configurations. (example) For real-world examples, see ❄️ Try it now! Launch our template VM: Or clone it and run the VM as you edit Our default template provides a layout for quickstart. |
You are done! You know everything there is to know about den for creating configurations with it.
However, if you want to learn more about how it works, I have tried to document some other topics in collapsible sections to avoid distraction from the introduction.
Basic Concepts and Patterns.#
Learn about aspects, static and parametric. Default aspects and dependencies.
Learn about aspects, static and parametric. Default aspects and dependencies.
There are two fundamental types of aspects in den, static and parametric.
Static aspects are just attribute sets#
|
Parametric aspects are just functions.#Important context variants in
|
The Default aspect and default Dependencies#
Den has an special aspect at den.default that serves for global configuration. den.default is included by default in all Hosts, Users and Homes. For example a Home configuration invokes den.default { inherit home; }, to obtain the aggregated defaults for home contexts.
Registering defaults values#It is possible to also register context-aware parametric aspects in Custom parametric providers.#The following is the code for how You can do the very same for other aspects of you
that can have context-aware aspects in their For more examples on parametric aspects explore our batteries.
|
Aspect dependencies#Accessing an aspect module causes Aditional to this, Host dependencies#Host also include Also for each user, User dependencies#User modules are read from os-home configurations. It basically invokes A user also depends on Home dependencies#Home just uses its own module, its includes, and invokes |
Aspect Organization Patterns#
Learn about organizing patterns for reuse.
Learn about organizing patterns for reuse.
No two nix configurations are the same. We all tend to organize things as we feel better. This section will try to outline some hints on possible ways to organize aspects, none of this is mandatory, and indeed you are encouraged to explore and share your own patterns and insights.
Having a namespace of aspects.#
The first principle is using .provides. (aka ._.) to nest your aspects as they make sense for you.
Unlike normal flake-parts, where modules are flat and people tend to use names like flake.modules.nixos."host/my-laptop" or nixos."feature/gaming" to avoid collission, in den you have a proper tree structure.
I (vic), use an aspect vix for all features on my system, and from there I create sub-aspects.
Because writing den.aspects.vix._.gaming._.emulation tends to be repetitive, I use the following vix alias as module argument.
This pattern is also shown in the default template, under
_profile.
NOTE:
denprovides an angle brackets experimental feature that allows even shorter syntax for deep.provide.access. See import-non-dendritic.nix for an example usage.
|
|
Using parametric aspects to route configurations.#
The following example routes configurations into the vix namespace.
This is just an example of using parametric aspects to depend on other
aspects in any part of the tree.
|
Use your imagination, come up with an awesome Dendritic setup that suits you. |
You made it to the end!, thanks for reading to this point. I hope you enjoy using
denas much as I have done writing it and have put dedication on it for being high quality-nix for you. <3. I feel like den is now feature complete, and it will not likely change.
Contributing.#
Yes, please, anything!. From fixing my bad english and typos, to sharing your ideas and experience with den in our discussion forums. Feel free to participate and be nice with everyone.
PRs are more than welcome, the CI runs some checks that verify nothing (known) is broken. Any new feature needs a test in _example/ci.nix.
If you need to run the test suite locally:
$ nix flake check ./checkmate --override-input target .
$ cd templates/default && nix flake check --override-input den ../..