File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed
Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -83,6 +83,16 @@ eachSystem allSystems (system: { hello = 42; })
8383}
8484```
8585
86+ If you pass a function rather than an attribute set after the ` system ` argument,
87+ it will receive as its argument the final attribute set. For example:
88+
89+ ``` nix
90+ eachSystem [ system.x86_64-linux ] (system: self: { a = 2; b = self.a + 3; })
91+ ```
92+
93+ ` self ` is not that useful in this case, as it can be replaced with the ` rec `
94+ keyword but there can be situations where it is preferred.
95+
8696### ` eachDefaultSystem :: (<system> -> attrs) `
8797
8898` eachSystem ` pre-populated with ` defaultSystems ` .
Original file line number Diff line number Diff line change 3333 # Merge together the outputs for all systems.
3434 op = attrs : system :
3535 let
36- ret = f system ;
36+ ret =
37+ let
38+ retOrFunc = f system ;
39+ in
40+ if builtins . isFunction retOrFunc
41+ then retOrFunc ret
42+ else retOrFunc ;
3743 op = attrs : key : attrs //
3844 {
3945 ${ key } = ( attrs . ${ key } or { } )
You can’t perform that action at this time.
0 commit comments