|
|
|
@ -224,47 +224,6 @@ lib.attrsets.mapAttrs
|
|
|
|
|
systemctl restart microvm@${name}.service
|
|
|
|
|
END
|
|
|
|
|
'';
|
|
|
|
|
|
|
|
|
|
"nomad-${name}" = pkgs.writeScriptBin "nomad-${name}" ''
|
|
|
|
|
#!${pkgs.runtimeShell} -e
|
|
|
|
|
|
|
|
|
|
${lib.optionalString (hostConfig.c3d2.deployment.server or null == "nomad") ''
|
|
|
|
|
echo "MicroVM must be configured for nomad" >&2
|
|
|
|
|
exit 1
|
|
|
|
|
''}
|
|
|
|
|
|
|
|
|
|
echo Copying Flakes
|
|
|
|
|
nix copy --no-check-sigs --to ssh-ng://root@hydra.serv.zentralwerk.org ${secrets} ${self}
|
|
|
|
|
|
|
|
|
|
echo Building on Hydra
|
|
|
|
|
ssh root@hydra.serv.zentralwerk.org -- \
|
|
|
|
|
nix build -L -o /tmp/microvm-${name}.job \
|
|
|
|
|
${self}#nixosConfigurations.${name}.config.system.build.nomadJob
|
|
|
|
|
|
|
|
|
|
echo -n Built. Obtaining path...
|
|
|
|
|
JOB=$(ssh root@hydra.serv.zentralwerk.org -- \
|
|
|
|
|
readlink /tmp/microvm-${name}.job)
|
|
|
|
|
echo \ $JOB
|
|
|
|
|
|
|
|
|
|
for h in server9 server10 ; do
|
|
|
|
|
echo Sharing with $h
|
|
|
|
|
ssh root@$h.cluster.zentralwerk.org -- \
|
|
|
|
|
bash -e <<EOF &
|
|
|
|
|
nix copy --from https://nix-serve.hq.c3d2.de $JOB
|
|
|
|
|
mkdir -p /glusterfs/fast/microvms/${name}
|
|
|
|
|
chown microvm:kvm /glusterfs/fast/microvms/${name}
|
|
|
|
|
chmod 0775 /glusterfs/fast/microvms/${name}
|
|
|
|
|
mkdir -p /nix/var/nix/gcroots/microvm
|
|
|
|
|
rm -f /nix/var/nix/gcroots/microvm/${name}
|
|
|
|
|
ln -sfT $JOB /nix/var/nix/gcroots/microvm/${name}
|
|
|
|
|
EOF
|
|
|
|
|
done
|
|
|
|
|
wait
|
|
|
|
|
|
|
|
|
|
echo Now starting the job
|
|
|
|
|
ssh root@hydra.serv.zentralwerk.org -- \
|
|
|
|
|
nomad run -detach $JOB
|
|
|
|
|
'';
|
|
|
|
|
})
|
|
|
|
|
{ }
|
|
|
|
|
(builtins.attrNames self.nixosConfigurations) //
|
|
|
|
|