- Nix 65.5%
- QML 28.9%
- Nushell 3.1%
- Haskell 1.9%
- Nu 0.6%
|
Some checks failed
Nix CI / Build: date (push) Failing after 3h27m29s
Nix CI / Build: kiwi (push) Failing after 3h27m31s
Nix CI / Build: pear (push) Failing after 3h29m8s
Nix CI / Build: plum (push) Failing after 3h29m5s
Nix CI / Build: sloe (push) Failing after 3h29m8s
Nix CI / Build: yuzu (push) Failing after 3h29m8s
Nix CI / Check: deadnix (push) Failing after 3h29m8s
Nix CI / Check: legacy imports (push) Failing after 3h29m5s
Nix CI / Check: statix (push) Failing after 45m51s
Signed-off-by: PlumJam <git@plumj.am> |
||
|---|---|---|
| .forgejo/workflows | ||
| .radicle | ||
| .tangled/workflows | ||
| ci | ||
| hosts | ||
| modules | ||
| secrets | ||
| .gitignore | ||
| .ignore | ||
| colours.txt | ||
| flake.lock | ||
| flake.nix | ||
| LICENSE | ||
| outputs.nix | ||
| README.md | ||
| Rebuild.hs | ||
| rebuild.nu | ||
| yubikey.pub | ||
PlumJam's Dendritic NixOS Configuration
Warning
Subject to major changes. This is not a finished state and some things are still being migrated from my old config.
Dendritic NixOS configurations for 8 personal machines:
| Name | System | Platform | Follows | Active |
|---|---|---|---|---|
| Blackwell | Server | x86_64-linux | nixos-unstable-small1 | |
| Date | Laptop | x86_64-linux | nixos-unstable-small1 | ✔ |
| Kiwi | Server | x86_64-linux | nixos-unstable-small1 | ✔ |
| Lime | Macbook | aarch64-darwin | nix-darwin2 | |
| Pear | WSL | x86_64-linux | nixos-wsl3 | ✔ |
| Plum | Server | x86_64-linux | nixos-unstable-small1 | ✔ |
| Sloe | Server | x86_64-linux | nixos-unstable-small1 | ✔ |
| Yuzu | Desktop | x86_64-linux | nixos-unstable-small1 | ✔ |
Features
- Multiple hosts
- Dendritic structure with flake-parts
- Hjem for $HOME management
- No
specialArgsor janky passing around of configs between layers4
How it works
Everything lives under modules/.
Each module (for the most part) is grouped by feature as opposed to individual
applications/services. Using
flake-parts, these modules live at
flake.modules.{nixos,darwin}.
Modules contains 1 or more of the following:
flake.modules.<class>.<aspect> = {}
For example, our modules/window-manager.nix looks like this:
{
flake.modules.nixos.window-manager = { /* ... */ };
flake.modules.darwin.window-manager = { /* ... */ };
}
hjem modules are included within the nixos and darwin classes via
hjem.extraModules as can be seen below.
I tend to write most configuration inside a let...in block and then assign a
single variable to the <class>.<aspect> like this:
let
zellijBase =
{
pkgs,
config,
lib,
...
}:
let
inherit (lib.meta) getExe;
inherit (lib.lists) singleton;
inherit (config) theme;
in
{
hjem.extraModules = singleton {
# ... hjem specific config
};
# ... rest of config
}
in
{
flake.modules.nixos.zellij = zellijBase;
flake.modules.darwin.zellij = zellijBase;
}
The darwin and nixos classes are then used in modules/hosts.nix. Some
aspects are grouped in modules/aspects.nix to avoid repeated configs and a
mkConfig helper is used to simplify the inline config module of each host,
again to reduce repetition. An example of what this could look like:
{
# For NixOS systems:
flake.nixosConfigurations.hostName = inputs.os.lib.nixosSystem {
specialArgs = { inherit inputs; };
modules = with inputs.self.modules.nixos; [
# ... other packages
window-manager
];
};
# Or for Darwin systems:
flake.darwinConfigurations.hostName = inputs.os-darwin.lib.darwinSystem {
specialArgs = { inherit inputs; };
modules = with inputs.self.modules.darwin; [
# ... other packages
window-manager
];
};
}
As mentioned before, additional configuration for the hosts is defined in an
inline module inside the modules = [] section of each host. There we define
configurations that are exclusive to the host and can't trivially be made a
module such as unique secrets configuration.
Other tools
Secrets
All secrets are handled by (r)agenix and agenix-rekey.
agenix: https://github.com/ryantm/agenix
ragenix: https://github.com/yaxitech/ragenix
agenix-rekey: https://github.com/oddlama/agenix-rekey
Imports
Imports are handled by an importTree function in modules/outputs.nix. It automatically imports all nix files in the specified directory (./modules in my case).
CI
Forgejo workflows are generated with actions.nix in ci/. On every push, each
host is built and cached automatically in an S3 bucket using self-hosted runners
(see modules/forgejo-action-runner.nix).
actions.nix is really nice, it gives you the power and flexibility of Nix for
creating workflows. See ci/nix-ci.nix and ci/lib.nix for some examples.
actions.nix: https://github.com/nialov/actions.nix
myLib
There may be unfamiliar functions/helpers in some files - these come from
modules/lib.nix.
Theming
I have a custom theming setup which can be seen in modules/theme.nix. It does
rely on a rebuild but it's a simple toggle between light/dark and gruvbox/pywal
modes by running shortcuts setup in Fuzzel. It automatically updates colour
schemes and refreshes necessary applications to apply changes.
The pywal mode generates colours from the current wallpaper.
The gruvbox mode uses the defined themes in modules/themes.nix and some base16
colours for applications that can make use of them.
Other comments
The previous version of my configurations can be seen on the pre-dendritic branch if you are interested. The dendritic version was merged from pull request #1 in commit #750cdc5fba on 2026-01-29.
A version using Hjem Rum can be seen on the hjem-rum branch. Hjem Rum was removed in pull request #2 in commit 962048fa7a on 2026-02-01. I'd like to mention that it is an excellent tool! I just didn't really need it and I already use generators or write config files directly for the most part anyway.
Modules that are yet to be migrated live in modules/_to-migrate/. The
underscore prefix tells my importTree function to ignore this directory so we can easily migrate them gradually without breaking builds.
Inputs use different names to what you might expect:
- nixpkgs -> os
- nix-darwin -> os-darwin
- nixos-wsl -> os-wsl
If you're interested in learning more about dendritic Nix, feel free to learn from my config and consider checking the following links:
- https://dendrix.oeiuwq.com/Dendritic.html
- https://github.com/Doc-Steve/dendritic-design-with-flake-parts
Sites I found helpful for Nix settings/options/lib:
- https://mynixos.com
- https://nix-darwin.github.io/nix-darwin/manual
- https://teu5us.github.io/nix-lib.html
Documentation for flake-parts:
Contributing
If you're more experienced with this style of configuration, I'm happy to accept criticism or suggestions for improvements via an issue or pull request.
Map
The structure of the repository and a few key files are highlighted below:
.
├── ci/ # CI with actions.nix (generates .forgejo/workflows/*)
│ └── ...
├── modules/ # All modules live in here
│ ├── outputs.nix # Flake outputs
│ ├── hosts.nix # Host definitions
│ ├── actions.nix # Generates CI workflows from `ci/`
│ ├── theme.nix # System-wide theming
│ ├── ...
│ ├── _to-migrate/ # Modules waiting for migration to new dendritic setup
│ │ └── ...
│ └── quickshell/ # Quickshell configs (not currently used)
│ └── ...
├── secrets/ # Secrets managed by agenix
│ ├── ...
│ └── rekeyed/ # Rekeyed secrets from agenix-rekey
│ └── ...
├── flake.lock
├── flake.nix
└── ...
License
The MIT License (MIT)
Copyright (c) 2025-present PlumJam <git@plumj.am>
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
Apart from inherit
specialArgs = { inherit inputs; };for each host. It is necessary for any host configuration. ↩︎