# The dendritic pattern (in response to comments in ‘How to define the default package for a NixOS module in a Nix flake?’)

**URL:** https://discourse.nixos.org/t/the-dendritic-pattern-in-response-to-comments-in-how-to-define-the-default-package-for-a-nixos-module-in-a-nix-flake/77326
**Category:** Uncategorized
**Created:** [April 30, 2026, 8:23am UTC](https://discourse.nixos.org/t/the-dendritic-pattern-in-response-to-comments-in-how-to-define-the-default-package-for-a-nixos-module-in-a-nix-flake/77326 "2026-04-30T08:23:56Z")
**Posts on this page:** 1
**Showing post:** 7

<div class="post-metadata">

### Author: ![FrdrCkII](https://discourse.nixos.org/user_avatar/discourse.nixos.org/frdrckii/32/31222_2.png) [@FrdrCkII](https://discourse.nixos.org/u/FrdrCkII)
#### Post date: [May 1, 2026, 4:31pm UTC](https://discourse.nixos.org/t/the-dendritic-pattern-in-response-to-comments-in-how-to-define-the-default-package-for-a-nixos-module-in-a-nix-flake/77326/7 "2026-05-01T16:31:27Z")

</div>

I have some ideas about dendritic patterns, but they may have nothing to do with the views of SergeK and TLATER. I’m not good at English, so I’m using a translator, with no intention to offend. I’m a complete beginner in nix, and most of these ideas are based on intuition, so corrections to any mistakes are welcome.

I think the problem with the dendritic pattern is that we used too many custom functions that are hard to modify.The dependencies of modules, the parameters passed to modules, and so on, these functions are all implemented by nix functions written by the dendritic pattern framework itself. This feels more like the style of `flake-utils` rather than `nixpkgs/flake-parts`. It completely ignores the options and type features of the module system, and this approach makes it impossible for users to modify the behavior of the framework. If you want an extra feature, you either have to modify the framework code or go through 200% of the effort to migrate to another framework.

When I try to implement a dendritic pattern [outside of flakes](https://discourse.nixos.org/t/falake-a-flake-parts-rewrite-without-flakes/73090), I often have the illusion that I am still doing something similar to `inputs.self.*`, but through `config`. It doesn’t feel like writing nix in a NixOS-like module system. I cannot simply affect another module through `config`. I had to create several specialized module variants.

If I have an impermanence module, then it would be difficult for me to directly use it in other modules in this way:

```nix
config = {
  out.imports = [./nixos-iwd.nix];
  hardware.impermanence = {
    dirs = ["/var/lib/iwd"];
  };
};

```

I often have to create multiple variant modules like `iwd-impermanence`, or handle it manually.

> [@TLATER](#):
>
> I _can_ kinda see it if you really know what you’re doing, and actually have that worst-case-complexity scenario where you want to maintain three different module systems and insist on grouping “shared” configuration between the three in single files.

Wow, this is exactly what I wanted to say!

I recently did something similar in my configuration by using specialized `evalModules` and a function similar to `extendModules`.

> **[nixprojects/nixconf/frix/min.prt.nix at main](https://codeberg.org/FrdrCkII/nixprojects/src/branch/main/nixconf/frix/min.prt.nix)**
>
> nixprojects - This monorepo contains my ( @FrdrCkI ) NixOS configuration and related utilities.

EDIT:  
(Some probably unrelated nonsense)  
Perhaps the original discussion was not completely unrelated to the dendritic pattern, and there is a reason for mentioning it. I remember Vic said, ‘The dendritic pattern is for the convenience of sharing configurations.’ So this is still a DI problem. The problem with nix is that it is really free. No one can guess where the entry point of a project is before reading the documentation.

> [@How to define the default package for a NixOS module in a Nix flake?](https://discourse.nixos.org/t/how-to-define-the-default-package-for-a-nixos-module-in-a-nix-flake/77311/12):
>
> Picking the right `pkgs` to use `callPackage` from is the responsibility of the user or the dependency injection layer. Flakes should have been that, the broken “follows” mechanism is the symptom of Flakes needing to be a that, but per their author they explicitly are not: [flake: add Nixpkgs default arguments as input by roberth · Pull Request #160061 · NixOS/nixpkgs · GitHub](https://github.com/NixOS/nixpkgs/pull/160061#issuecomment-1178999597), [ELSEWHERE](https://someonex.net/scratch/ota-flakes/#failure-weak-di-1)

This is what nixers has been doing all along, but it is not user-friendly at all! `Flakes` might be a solution. But in my opinion, flakes are a ‘compromise’ solution. It builds an ordered ‘virtual file system’ in the nix data structure, but essentially it is still a compromise with the unordered reality of the project’s actual file structure.

> [@Why flake must be trivial?](https://discourse.nixos.org/t/why-flake-must-be-trivial/70611/3):
>
> It’s to ensure that Nix can obtain the metadata of a flake (such as its inputs) without having to execute a Turing-complete program that may not terminate. That is, a command like `nix flake info` should finish in some bounded amount of time.

I guess flakes were intentionally designed to be simple, because we always need to check what a flake actually provides through `nix flake show`.

The dendritic pattern was originally built on top of the flakes foundation, right? But after studying the nixpkgs module system, I feel that the dendritic pattern might have made a flawed system abstraction: it treats the module system as an untyped attribute set framework, thereby losing both the declarative dependency handling and AOP advantages of the nixpkgs module system, while also failing to achieve the simple evaluability of flakes. It is an intermediary layer that is, in the worst sense, ‘unsupported on both ends.’

BTW, I have always felt a ghost of Guix wandering around these discussions. Guix is not like this. Scheme has a clear module system that relies on the existence of real file structures. Therefore, they never need to discuss the issue of entry points.

---

_[View the full topic](https://discourse.nixos.org/t/the-dendritic-pattern-in-response-to-comments-in-how-to-define-the-default-package-for-a-nixos-module-in-a-nix-flake/77326)._
