Recent Migration Related Issues/Feedback Mega-thread
We recently landed a very massive architecture shift with a number of API changes.
There are new docs at https://den.denful.dev/
There's a migration guide for those seeing ctx related warnings or errors: https://den.denful.dev/guides/migrate-ctx/
You no longer need to use den.lib.perHost/perUser/etc -- aspects are functions and can handle bare resolution, just pass {host} {user} or {host,user}. These fields are now also exposed directly to classes, and you only need them on the aspect if you wanted to provide different class modules by user.
We have a new rich policy system, it's in the documentation and an example is provided in the fleet-demo and terranix-demo templates of some usecases. Richer examples will come later.
Please share any issues here. I'm on-call 9AM-10PM PST or 4PM - 5AM UTC to offer support. I'll be following issues here on Github, but the fastest way to get my attention and get personalized direct debugging help is on our Matrix channel where I'm spending honestly too much of my day.
My goal is to make sure any issues you encounter are resolved ASAP.
The old docs now 404s, could you maybe set it up so it redirects to the new docs?
Search engines now bring up a ton of dead links when you search for den, and they haven't indexed the new docs yet, so I had to rely on GitHub's redirect from the old repo URL to this one to find out where you all went 😅
@vic anything you can do with regard to the pre- denful.dev routing?
I will forward *.oeiuwq.com domains into *.denful.dev
Hello,
We recently landed a very massive architecture shift with a number of API changes.
Thanks for all this amazing work!
Please share any issues here.
Migrating ctx works fine but I have some issue during den.aspects.X._.Y to den.aspects.X.Y migration.
For example:
{
den.aspects.system._.base.nixos =
{ pkgs, ... }:
{
environment.systemPackages = with pkgs; [
fastfetch
];
};
den.aspects.system._.base.nixos =
{ pkgs, ... }:
{
fonts.packages = with pkgs; [
nerd-fonts.dejavu-sans-mono
];
};
}
works but
{
den.aspects.system.base.nixos =
{ pkgs, ... }:
{
environment.systemPackages = with pkgs; [
fastfetch
];
};
den.aspects.system.base.nixos =
{ pkgs, ... }:
{
fonts.packages = with pkgs; [
nerd-fonts.dejavu-sans-mono
];
};
}
doesn't (fastfetch package is not included).
So it looks like sub-aspects are not merged together and the last definition erases the first one.
I have another issue with sub-aspects.
With:
{
den.aspects.apps.dev-tools.homeManager = {
};
den.aspects.apps.dev-tools.foo.homeManager = {
};
}
If I only include <apps/dev-tools>, packages from <apps/dev-tools/foo> will also be included.
@blemouzy Thanks for the report, I have a good intuition as to why and will try and push a fix this morning. I'm assuming on the first one your example is simplified and not in the same file. :)
I'm assuming on the first one your example is simplified and not in the same file.
Yes, they are in separated files.
@blemouzy fixed both in #521 -- thanks for the high quality report. :)
~~Hi, I've got this issue while migrating away from ._., .provides..~~
{ denTest, ... }:
{
flake.tests.bogus = {
test-something = denTest (
{ den, igloo, ... }:
{
den.hosts.x86_64-linux.igloo.users.tux = { };
den.aspects.igloo.includes = [ den.aspects.root ];
den.aspects.root = {
includes = [ den.aspects.root.a ];
# fails
a.nixos.environment.variables.FROM_A = "yes";
b.nixos.environment.variables.FROM_B = "yes";
# passes
# provides.a.nixos.environment.variables.FROM_A = "yes";
# provides.b.nixos.environment.variables.FROM_B = "yes";
};
expr = {
hasA = igloo.environment.variables ? FROM_A;
hasB = igloo.environment.variables ? FROM_B;
};
expected = {
hasA = true;
hasB = false;
};
}
);
};
}
EDIT: I take that back, documentation changes in #504 removed a few to many .provides. so I assumed that sub-aspects can now be defined without .provides..
Missing provides
https://github.com/denful/den/blob/7cdfb07bcbf88ba8575cf191ca2b7f70a708544b/docs/src/content/docs/explanation/aspects.mdx?plain=1#L99 https://github.com/denful/den/blob/7cdfb07bcbf88ba8575cf191ca2b7f70a708544b/docs/src/content/docs/guides/configure-aspects.mdx?plain=1#L148 https://github.com/denful/den/blob/7cdfb07bcbf88ba8575cf191ca2b7f70a708544b/docs/src/content/docs/guides/configure-aspects.mdx?plain=1#L160 https://github.com/denful/den/blob/7cdfb07bcbf88ba8575cf191ca2b7f70a708544b/docs/src/content/docs/guides/home-manager.mdx?plain=1#L146 https://github.com/denful/den/blob/7cdfb07bcbf88ba8575cf191ca2b7f70a708544b/docs/src/content/docs/reference/batteries.mdx?plain=1#L130-L133 https://github.com/denful/den/blob/7cdfb07bcbf88ba8575cf191ca2b7f70a708544b/docs/src/content/docs/guides/batteries.mdx?plain=1#L50-L53 https://github.com/denful/den/blob/7cdfb07bcbf88ba8575cf191ca2b7f70a708544b/docs/src/content/docs/tutorials/ci.mdx?plain=1#L134
@blemouzy fixed both in #521 -- thanks for the high quality report. :)
Includes scoping: Explicitly including a nested aspect via den.aspects.X.Y no longer auto-walks its nested sub-keys. Sub-aspects at deeper levels must be included explicitly. Direct nesting and organizational grouping continue to auto-walk as before.
That works fine.
Multi-definition merge: When multiple modules define the same nested aspect key, class sub-keys are now properly collected instead of last-win overwrite. emitNestedAspect reconstructs per-sub-key __contentValues so all definitions contribute.
That still doesn't work.
I have several files, all with den.aspects.system.base:
$ ls -1 modules/system/base
console.nix
flakes.nix
fonts.nix
garbage-collector.nix
locale.nix
packages.nix
timezone.nix
users.nix
-
console.nix:
{ den.aspects.system.base.nixos = { console.keyMap = "fr"; }; } -
flakes.nix:
{ den.aspects.system.base.nixos = { nix.settings.experimental-features = [ "nix-command" "flakes" ]; }; } -
...
-
users.nix:
{ den.aspects.system.base.nixos = { pkgs, ... }: { # users = { # mutableUsers = false; # users = { # root = { # hashedPassword = "!"; # shell = pkgs.zsh; # }; # }; # }; }; } # TODO: # - Add users.mutableUsers = false;
At the end, they still looks un-merged.
I also have another issue with aspect with parameter:
{
den.aspects.window-manager._.gnome-autologin = username: {
nixos = {
services.displayManager.autoLogin = {
enable = true;
user = username;
};
};
};
}
# Another file
{
__findFile,
den,
...
}:
{
den.aspects.nixos-vm-test = {
includes = [
<window-manager/gnome>
(<window-manager/gnome-autologin> "benjamin")
];
};
}
works but the version without the ._. doesn't work:
error: attempt to call something which is not a function but a set: { __contentValues = [ { file = «thunk»; value = «lambda gnome-autologin @ /nix/store/i07rhqkksj6kshxpdjn5v1nkbm9fiv0d-source/modules/window-manager/gnome-autologin.nix:2:48»; } ]; __provider = «thunk»; }
at /nix/store/i07rhqkksj6kshxpdjn5v1nkbm9fiv0d-source/modules/hosts/nixos-vm-test/default.nix:17:8:
16| <window-manager/gnome>
17| (<window-manager/gnome-autologin> "benjamin")
| ^
18| ];
@osatomic Actually, they should be able to so I'll take a look at it.
@blemouzy Thanks. It would seem I traded a aspect merge issue for a class merge issue. :D Closer! I'll fix it first thing in the morning.
edit: I couldn't fall asleep so I took a look early. :)
Alright, I just opened #527 which reproduced and then addressed 2 of the 3 reported issues
@osatomic Any chance you can verify that my branch github:sini/den/fix/nested-includes-and-content-functor works?
@blemouzy
I have good news and bad news -- I was able to reproduce and fix your functor application bug, but I'm not able to reproduce your reported nixos class module merge issues:
test-multi-file-base-nixos = denTest (
{ den, igloo, ... }:
{
imports = [
# console.nix
{ den.aspects.system.base.nixos.console.keyMap = "fr"; }
# flakes.nix
{ den.aspects.system.base.nixos.nix.settings.experimental-features = [ "nix-command" "flakes" ]; }
# fonts.nix
{ den.aspects.system.base.nixos.fonts.enableDefaultPackages = true; }
# garbage-collector.nix
{ den.aspects.system.base.nixos.nix.gc.automatic = true; }
# locale.nix
{ den.aspects.system.base.nixos.i18n.defaultLocale = "fr_FR.UTF-8"; }
# packages.nix
{ den.aspects.system.base.nixos.environment.variables.EDITOR = "vim"; }
# timezone.nix
{ den.aspects.system.base.nixos.time.timeZone = "Europe/Paris"; }
# users.nix (function-valued module)
{ den.aspects.system.base.nixos = { pkgs, ... }: { }; }
];
den.hosts.x86_64-linux.igloo.users.tux = { };
den.aspects.igloo.includes = [ den.aspects.system ];
expr = {
hasKeyMap = igloo.console.keyMap == "fr";
hasFlakes = builtins.elem "flakes" igloo.nix.settings.experimental-features;
hasFonts = igloo.fonts.enableDefaultPackages;
hasGC = igloo.nix.gc.automatic;
hasLocale = igloo.i18n.defaultLocale == "fr_FR.UTF-8";
hasEditor = igloo.environment.variables.EDITOR == "vim";
hasTimezone = igloo.time.timeZone == "Europe/Paris";
};
expected = {
hasKeyMap = true;
hasFlakes = true;
hasFonts = true;
hasGC = true;
hasLocale = true;
hasEditor = true;
hasTimezone = true;
};
}
);
I've also tried splitting it up over multiple input files with raw import in case it was related to the internal nix module internal filepath logic -- same result, all passed. Any chance you can provide me with a failing test, or grant me access to your flake for testing? I'd love to get you up and running ASAP. :)
I was able to reproduce and fix your functor application bug
Yes, that indeed works with your fix.
Any chance you can provide me with a failing test, or grant me access to your flake for testing?
Sure: my current config is not yet ready to be publically shared but I share with you a private Github repo (https://github.com/blemouzy/nixos-private) with my config with some private files removed (if you still find private stuff, please forget it :))
@blemouzy My lips are sealed. #burnafterreading :)
I found a regression that I introduced when working on another issue that is unintentionally eagerly importing directly nested aspects (an artifact of the provides/mutual-providers mechanism), which is the opposite of what you're reporting, so I'll fix that first and then debug your flake -- that's going to wait til the morning though because its now 1am. :) Thank you for your patience and thank you for helping get these gremlins sorted.
@blemouzy
Tested with --override-input den pointing at fix/nested-includes-and-content-functor branch on your config and your bug report:
$ nix eval --override-input den . .#nixosConfigurations.nixos-desktop.config.console.keyMap
"fr"
$ nix eval --override-input den . .#nixosConfigurations.nixos-desktop.config.i18n.defaultLocale
"fr_FR.UTF-8"
$ nix eval --override-input den . .#nixosConfigurations.nixos-desktop.config.time.timeZone
"Europe/Paris"
All three values come from separate module files from your example (console.nix, locale.nix, timezone.nix) and confirm multi-def merge is working.
Your second bug, parametric aspect without provides:
$ nix eval --override-input den . .#nixosConfigurations.nixos-vm-test.config.services.displayManager.autoLogin.user
"benjamin"
(<window-manager/gnome-autologin> "benjamin") works without _. / provides. wrapper.
Full eval:
$ nix eval --override-input den . .#nixosConfigurations.nixos-desktop.config.system.build.toplevel.drvPath
"/nix/store/fvc6hln4pg8r1x0q9mvkkrxw7ywsdrrw-nixos-system-nixos-desktop-25.11.20260429.755f5aa.drv"
PR of the changes is #527 -- let me know if you still see any regressions.
PR of the changes is https://github.com/denful/den/pull/527 -- let me know if you still see any regressions.
Everything looks good with my configuration: I have no regression from den v0.15.0.
Thanks!
Thanks for the quick test. #527 is now merged!
Sometimes I wonder if it was too ambitious to provide support for mixed class/quirk/parametric function/static aspects all in the same recursive dynamic keyspace... but we seem to be making it work thus far.
Keep the error reports coming!
Hi, i found another issue.
excludes doesn't work well when define sub-aspect without prefix _ / provides. Here for the example:
test-excludes = denTest ({ den, igloo, lib, ... }:
{
den.hosts.x86_64-linux.igloo.users.tux = {};
den.aspects.my-aspect = {
includes = with den.aspects.my-aspect; [ sub-aspect1 sub-aspect2 ];
sub-aspect1.nixos.environment.variables.SUB_ASPECT_1 = "yes";
_.sub-aspect2.nixos.environment.variables.SUB_ASPECT_2 = "yes";
};
den.aspects.igloo.includes = [
den.aspects.my-aspect
];
den.aspects.igloo.excludes = [
den.aspects.my-aspect.sub-aspect1
den.aspects.my-aspect.sub-aspect2
];
expr.sub-aspect1 = igloo.environment.variables ? SUB_ASPECT_1;
expr.sub-aspect2 = igloo.environment.variables ? SUB_ASPECT_2;
expected.sub-aspect1 = false;
expected.sub-aspect2 = false;
});
The result:
❌ test-excludes
/tmp/nix-969374-449954707/expected.nix --- Nix
1 { sub-aspect1 = true; sub-aspect2 = false; } 1 { sub-aspect1 = false; sub-aspect2 = false; }
I'm not sure how excludes works, but i think it's probably because the sub-aspect isn't defined as a sub-aspect when it's evaluated in excludes. In the repl, it shows like this:
nix-repl> den.aspects.my-aspect.sub-aspect1
{
__contentValues = [ ... ];
__provider = [ ... ];
}
nix-repl> den.aspects.my-aspect.sub-aspect2
{
_ = { ... };
__functor = «lambda resolveAspectWith @ /nix/store/vifkw44k56rwkhzackpql87w61s8g6y2-source/nix/lib/aspects/types.nix:41:5»;
__providesForwarded = [ ... ];
classes = { ... };
description = "Aspect sub-aspect2";
excludes = [ ... ];
includes = [ ... ];
meta = { ... };
name = "sub-aspect2";
policies = «repeated»;
provides = «repeated»;
}
The value of sub-aspect1 is same like a class, instead of an aspect.
This should be addressed in #542. Thanks again for your review. :)