File tree Expand file tree Collapse file tree 1 file changed +20
-4
lines changed
nix/cloud/nomadEnvs/cicero Expand file tree Collapse file tree 1 file changed +20
-4
lines changed Original file line number Diff line number Diff line change 92
92
data = let
93
93
templates = [
94
94
{
95
- # this will be changed to DestPath in the transformer
96
95
DestPathInHome = ".ssh/known_hosts" ;
96
+ append = true ;
97
97
98
98
EmbeddedTmpl = let
99
99
builder = i : ''
116
116
'' ;
117
117
}
118
118
{
119
- # this will be changed to DestPath in the transformer
120
119
DestPathInHome = ".config/nix/nix.conf" ;
120
+ append = true ;
121
121
122
122
EmbeddedTmpl = let
123
123
builder = i :
''ssh://[email protected] .${ toString i } x86_64-darwin /secrets/id_buildfarm 4 2 big-parallel - {{index .Data.data "darwin${ toString i } -public" | base64Encode}}'' ;
135
135
in ''
136
136
#! /bin/bash
137
137
/bin/jq --compact-output \
138
- --argjson templates '{{ base64Decode " ${ lib . fileContents templatesJsonBase64 } " }}' \
138
+ --arg templates ${ lib . escapeShellArg ( lib . fileContents templatesJsonBase64 ) } \
139
139
'
140
140
.job.TaskGroups[]?.Tasks[]? |=
141
141
.Env.HOME as $home |
142
142
if $home == null
143
143
then error("`.job.TaskGroups[].Tasks[].Env.HOME` must be set for the darwin-nix-remote-builders transformer")
144
144
else .Templates |= (
145
145
. + (
146
- $templates |
146
+ $templates | @base64d | fromjson |
147
147
map(
148
148
if has("DestPathInHome")
149
149
then del(.DestPathInHome) + {DestPath: ($home + "/" + .DestPathInHome)}
150
150
else .
151
151
end
152
152
)
153
153
) |
154
+ group_by(.DestPath) |
155
+ map(
156
+ sort_by(.append) |
157
+ if .[length - 1].append | not
158
+ then .
159
+ else [reduce .[range(1; length)] as $tmpl (
160
+ .[0];
161
+ if $tmpl | .append | not
162
+ then error("Multiple templates that are not meant to be appended have the same destination")
163
+ else . + {EmbeddedTmpl: (.EmbeddedTmpl + "\n" + $tmpl.EmbeddedTmpl)}
164
+ end
165
+ )]
166
+ end |
167
+ .[] |
168
+ del(.append)
169
+ ) |
154
170
unique
155
171
)
156
172
end
You can’t perform that action at this time.
0 commit comments