From 318186e868998a8e055b74a072c90fe2b5a3e11d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20Migu=C3=A9ns=20Iglesias?= Date: Tue, 9 Jun 2026 09:34:12 +0200 Subject: [PATCH] feat: add batteries.user-modules Works exactly like batteries.host-modules but in reverse, allowing `host.class`es from the user aspect tree to be projected into onto hosts that include it. --- modules/aspects/batteries/user-aspects.nix | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 modules/aspects/batteries/user-aspects.nix diff --git a/modules/aspects/batteries/user-aspects.nix b/modules/aspects/batteries/user-aspects.nix new file mode 100644 index 000000000..a8d038456 --- /dev/null +++ b/modules/aspects/batteries/user-aspects.nix @@ -0,0 +1,30 @@ +{ den, lib, ... }: +let + description = '' + Projects all `host.class`es like `nixos` from the user's aspect tree onto + hosts that opt in. Requires the fx pipeline. + + ## Usage + + den.aspects.igloo.includes = [ den.batteries.user-aspects ]; + + Any user aspect that defines a `host.class` key will have that config + forwarded to the hosts's evaluation. + ''; + + from-user = + { host, user, ... }: [ (den.lib.policy.spawn { classes = [ host.class ]; }) ]; +in +{ + den.batteries.user-aspects = { + name = "user-aspects"; + inherit description; + includes = [ + { + __isPolicy = true; + name = "user-aspects-project"; + fn = from-user; + } + ]; + }; +}