If Den or other denful libs have been of use to you, consider sponsoring.
NOTE: Den no longer relates to the
"Dendritic"name, Den was born to explore the limits of that pattern and has evolved to something much more advanced and flexible, the official dendritic repo no longer considers this Dendritic.
Write a feature once. Run it on every host, user, and platform you have — and share it with anyone, flake or not.
Den turns Nix configuration into composable features instead of per-host piles of modules. A Den aspect is a plain function: give it context (your hosts and users) and it returns configuration for every Nix class it touches — nixos, darwin, homeManager, hjem, or a class you invent.
# An aspect is a function of context that returns
# configuration for many Nix classes at once.
den.aspects.gaming = { host, user }: {
nixos = { pkgs, ... }: { programs.steam.enable = true; };
darwin = { pkgs, ... }: { /* ... */ };
homeManager = { pkgs, ... }: { /* ... */ };
includes = [ den.aspects.performance ]; # aspects compose
provides.emulation = { nixos = { /* ... */ }; }; # and nest
};That one idea — a feature as a function — is what makes the rest possible.
- One feature, everywhere, in one place. Stop scattering a single concern across separate
nixos,darwin, andhomeManagerfiles. An aspect holds all of it together. - Reuse across hosts, users — and across projects. Share aspects between machines, between people, and between flake and non-flake setups, without forcing everyone to download each other's inputs.
- No
mkIf/enableclutter. The shape of the context is the condition — a function that asks for{ host, user }simply doesn't run where there's no user. Conditionals disappear. - Hosts shape their users, users shape their hosts. Cross-entity configuration flows both ways, without coupling them together.
- Add a capability in one line; remove it by deleting that line. Hosts just pick the aspects they want.
- Bring your own classes and whole pipelines. Custom Nix classes, machine fleets, MicroVM guests, terranix, standalone neovim — if you can walk it as data, Den can configure it.
Four concepts, one job each:
- Entity — what exists: a host, user, or home.
- Aspect — what it does: a feature, spanning Nix classes.
- Policy — how entities relate: topology and routing between them.
- Quirk — structured data aspects share, without coupling.
Feature-first, not host-first. Traditional setups start from hosts and push modules down; Den flips that — features are primary, hosts just select them.
Den embraces your Nix. With or without flakes, flake-parts, or home-manager. Zero dependencies. Every part is optional and replaceable — Den works with the setup you already have, and gets out of the way.
# a MicroVM
nix run github:denful/den?dir=templates/microvm#runnable-microvm
# a standalone neovim
nix run github:denful/den?dir=templates/nvf-standalone#my-neovim
# a qemu VM
nix run github:denful/den|
Pick a starting point and grow from there:
Growing adoption: usage search |
Den takes the Dendritic pattern to a whole new level, and I cannot imagine going back.
—@adda, early Den adopter (after Dendritic flake-parts and Unify)
I'm super impressed with den so far, I'm excited to try out some new patterns that Unify couldn't easily do.
—@quasigod, author of Unify
Massive work you did here!
—@drupol, author of “Flipping the Configuration Matrix”
Thanks for the awesome library and the support for non-flakes… it's positively brilliant! I really hope this gets wider adoption.
—@vczf, at#den-lib:matrix.org
Den is a playground for some very advanced concepts… some of its ideas will play a role in future Nix areas. There are some raw diamonds in Den.
—@Doc-Steve, author of the Dendritic Design Guide
