Drone VM works

This commit is contained in:
Alex 2022-05-30 17:04:03 +02:00
parent 4ec5cc43d4
commit 0c015b4e0c
Signed by untrusted user: lx
GPG key ID: 0E496D15096376BE
2 changed files with 7 additions and 8 deletions

View file

@ -42,9 +42,13 @@ with lib;
virtualisation.docker.enable = true; virtualisation.docker.enable = true;
virtualisation.oci-containers.backend = "docker"; virtualisation.oci-containers.backend = "docker";
systemd.user.services.drone_nix_setup = { systemd.services.drone_nix_setup = {
enable = true;
path = [
pkgs.docker
];
script = '' script = ''
docker run --rm -it -v /var/lib/drone/nix:/mnt nixpkgs/nix:nixos-21.05 cp -r /nix/{store,var} /mnt/ docker run --rm -v /var/lib/drone/nix:/mnt nixpkgs/nix:nixos-21.05 cp -r /nix/{store,var} /mnt/
''; '';
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
}; };

View file

@ -9,12 +9,6 @@ job "drone-runner" {
} }
} }
constraint {
attribute = "${attr.unique.hostname}"
operator = "="
value = "caribou"
}
task "drone-runner-vm" { task "drone-runner-vm" {
driver = "qemu" driver = "qemu"
@ -25,6 +19,7 @@ job "drone-runner" {
"-drive", "index=1,file=fat:rw:/var/lib/nomad/alloc/${NOMAD_ALLOC_ID}/${NOMAD_TASK_NAME}/secrets,format=raw,media=disk", "-drive", "index=1,file=fat:rw:/var/lib/nomad/alloc/${NOMAD_ALLOC_ID}/${NOMAD_TASK_NAME}/secrets,format=raw,media=disk",
"-device", "e1000,netdev=user.0", "-device", "e1000,netdev=user.0",
"-netdev", "user,id=user.0,hostfwd=tcp::${NOMAD_PORT_ssh}-:22", "-netdev", "user,id=user.0,hostfwd=tcp::${NOMAD_PORT_ssh}-:22",
"-smp", "2",
] ]
port_map { port_map {
ssh = 22 ssh = 22