Skip to content

Commit e9dc3a1

Browse files
committed
cicero job: adapt transformer to new cicero version
1 parent e2b5af5 commit e9dc3a1

File tree

1 file changed

+27
-21
lines changed

1 file changed

+27
-21
lines changed

nix/cloud/nomadEnvs/cicero/default.nix

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -44,28 +44,34 @@
4444
/bin/jq --compact-output \
4545
--argjson args ${lib.escapeShellArg (builtins.toJSON args)} \
4646
'
47-
.job[]?.datacenters |= . + $args.datacenters |
48-
.job[]?.group[]?.task[]? |= (
49-
.vault.policies |= . + ["cicero"] |
50-
.env |= . + {
51-
NOMAD_ADDR: env.NOMAD_ADDR,
52-
NOMAD_TOKEN: env.NOMAD_TOKEN,
53-
CICERO_WEB_URL: $args.ciceroWebUrl,
54-
NIX_CONFIG: ($args.nixConfig + .NIX_CONFIG),
55-
} |
56-
.template |= . + [{
57-
destination: "local/post-build-hook",
58-
perms: "544",
59-
data: $args.postBuildHook,
60-
}] |
61-
if .driver != "nix" or .config?.nixos then . else
62-
.config.packages |=
63-
# only add bash if needed to avoid conflicts in profile
64-
if any(endswith("#bash") or endswith("#bashInteractive"))
65-
then .
66-
else . + ["github:NixOS/nixpkgs/\($args.nixpkgsRev)#bash"]
47+
.job |= (
48+
.Datacenters += $args.datacenters |
49+
.TaskGroups[]?.Tasks[]? |= (
50+
.Env += {
51+
NOMAD_ADDR: env.NOMAD_ADDR,
52+
NOMAD_TOKEN: env.NOMAD_TOKEN,
53+
CICERO_WEB_URL: $args.ciceroWebUrl,
54+
NIX_CONFIG: ($args.nixConfig + .NIX_CONFIG),
55+
} |
56+
.Templates += [{
57+
DestPath: "local/post-build-hook",
58+
Perms: "544",
59+
EmbeddedTmpl: $args.postBuildHook,
60+
}]
61+
) |
62+
if .Type != null and .Type != "batch" then . else (
63+
.TaskGroups[]?.Tasks[]? |= (
64+
.Vault.Policies += ["cicero"] |
65+
if .Driver != "nix" or .Config?.nixos then . else
66+
.Config.packages |=
67+
# only add bash if needed to avoid conflicts in profile
68+
if any(endswith("#bash") or endswith("#bashInteractive"))
69+
then .
70+
else . + ["github:NixOS/nixpkgs/\($args.nixpkgsRev)#bash"]
71+
end
6772
end
68-
end
73+
)
74+
) end
6975
)
7076
'
7177
'';

0 commit comments

Comments
 (0)