tangled
alpha
login
or
join now
oeiuwq.com
/
den
8
fork
atom
Modular, context-aware and aspect-oriented dendritic Nix configurations. Discussions: https://oeiuwq.zulipchat.com/join/nqp26cd4kngon6mo3ncgnuap/
den.oeiuwq.com
configurations
den
dendritic
nix
aspect
oriented
8
fork
atom
overview
issues
4
pulls
2
pipelines
forward test for example nix class -> hm and os
oeiuwq.com
3 weeks ago
2e34f655
e67df226
1/1
mirror.yml
success
3s
+56
-5
4 changed files
expand all
collapse all
unified
split
docs
src
content
docs
reference
batteries.mdx
tutorials
ci.md
modules
aspects
provides
forward.nix
templates
ci
modules
features
forward-from-custom-class.nix
+1
-1
docs/src/content/docs/reference/batteries.mdx
reviewed
···
138
138
## forward
139
139
140
140
Creates custom Nix classes by forwarding configs between classes.
141
141
-
([source](https://github.com/vic/den/blob/main/modules/aspects/provides/forward.nix) · [tests](https://github.com/vic/den/blob/main/templates/ci/modules/features/forward.nix) · [usage guide](/guides/custom-classes/))
141
141
+
([source](https://github.com/vic/den/blob/main/modules/aspects/provides/forward.nix) · [tests](https://github.com/vic/den/blob/main/templates/ci/modules/features/forward-from-custom-class.nix) · [usage guide](/guides/custom-classes/))
142
142
143
143
```nix
144
144
den._.forward {
+1
-1
docs/src/content/docs/tutorials/ci.md
reviewed
···
102
102
|-----------|---------------|
103
103
| [angle-brackets.nix](https://github.com/vic/den/blob/main/templates/ci/modules/features/angle-brackets.nix) | All bracket resolution paths |
104
104
| [namespaces.nix](https://github.com/vic/den/blob/main/templates/ci/modules/features/namespaces.nix) | Local, remote, merged namespaces |
105
105
-
| [forward.nix](https://github.com/vic/den/blob/main/templates/ci/modules/features/forward.nix) | Custom class forwarding |
105
105
+
| [forward-from-custom-class.nix](https://github.com/vic/den/blob/main/templates/ci/modules/features/forward-from-custom-class.nix) | Custom class forwarding |
106
106
| [homes.nix](https://github.com/vic/den/blob/main/templates/ci/modules/features/homes.nix) | Standalone Home-Manager configs |
107
107
| [schema-base-modules.nix](https://github.com/vic/den/blob/main/templates/ci/modules/features/schema-base-modules.nix) | `den.base.{host,user,home,conf}` |
108
108
+6
-2
modules/aspects/provides/forward.nix
reviewed
···
33
33
See also: https://github.com/vic/den/issues/160, https://github.com/vic/flake-aspects/pull/31
34
34
'';
35
35
36
36
-
forward =
36
36
+
forwardEach = fwd: {
37
37
+
includes = map (item: forwardOne (fwd // { each = [ item ]; })) fwd.each;
38
38
+
};
39
39
+
40
40
+
forwardOne =
37
41
{
38
42
guard ? null,
39
43
adaptArgs ? null,
···
91
95
{
92
96
den.provides.forward = {
93
97
inherit description;
94
94
-
__functor = _self: forward;
98
98
+
__functor = _self: forwardEach;
95
99
};
96
100
}
+48
-1
templates/ci/modules/features/forward-from-custom-class.nix
reviewed
···
1
1
{ denTest, ... }:
2
2
{
3
3
-
flake.tests.forward = {
3
3
+
flake.tests.forward-custom-class = {
4
4
5
5
test-forward-custom-class-to-nixos = denTest (
6
6
{
···
111
111
112
112
expr = igloo.home-manager.users.tux.programs.git.userEmail;
113
113
expected = "root@linux.com";
114
114
+
}
115
115
+
);
116
116
+
117
117
+
test-custom-nix-class-fowards-to-both-hm-and-nixos = denTest (
118
118
+
{
119
119
+
den,
120
120
+
lib,
121
121
+
igloo,
122
122
+
...
123
123
+
}:
124
124
+
let
125
125
+
forwarded =
126
126
+
{ class, aspect-chain }:
127
127
+
den._.forward {
128
128
+
each = [
129
129
+
"nixos"
130
130
+
"homeManager"
131
131
+
];
132
132
+
fromClass = _: "nix";
133
133
+
intoClass = lib.id;
134
134
+
intoPath = _: [ "nix" ];
135
135
+
fromAspect = _: lib.head aspect-chain;
136
136
+
adaptArgs =
137
137
+
{ config, ... }:
138
138
+
{
139
139
+
osConfig = config;
140
140
+
};
141
141
+
};
142
142
+
in
143
143
+
{
144
144
+
den.hosts.x86_64-linux.igloo.users.tux = { };
145
145
+
146
146
+
den.aspects.igloo.homeManager.home.stateVersion = "25.11";
147
147
+
148
148
+
den.aspects.tux = {
149
149
+
includes = [ forwarded ];
150
150
+
nix.settings.allowed-users = [ "tux" ];
151
151
+
};
152
152
+
153
153
+
expr = {
154
154
+
os = igloo.nix.settings.allowed-users;
155
155
+
hm = igloo.home-manager.users.tux.nix.settings.allowed-users;
156
156
+
};
157
157
+
expected = {
158
158
+
os = [ "tux" ];
159
159
+
hm = [ "tux" ];
160
160
+
};
114
161
}
115
162
);
116
163