Closed cliarena closed 1 year ago
it looks like i needed to use it like that:
jobs = nix-nomad.lib.mkNomadJobs {
system = "x86_64-linux";
# system = "aarch64-linux";
config = [ ./nginx.nix ];
};
resource.nomad_job.nginx = {
jobspec = ''''${file("${jobs}/nginx.json")}'';
json = true;
};
yep, that's one way to do it. there's a few other ways you could do it. my preference is to actually include the nix-nomad module in my terranix config and reference nomad.build.apiJobFile
. I'm on vacation in Europe atm and can't check the exact config, but I think something along the lines of this works:
{ config, ... }:
let
inherit (config.nomad.build) apiJobFile;
in
{
imports = [
"${nix-nomad}/modules"
];
job.foo.group.foo.task.foo = {
driver = "raw_exec";
config.command = "echo";
};
resource.nomad_job.nginx = {
jobspec = apiJobFile.foo;
json = true;
};
}
this gives you a lot of control/modularity for your infra
i think the jobspec
line should be:
jobspec = lib.strings.toJSON apiJob.foo;
(importing apiJob
over apiJobFile
earlier)
hi.
is there an example of how to use it with terranix. how to pass hello.nix to resource.nomad_job
thank you so much