diff --git a/hosts/common/global/packages.nix b/hosts/common/global/packages.nix index 2668570..e3cac5d 100644 --- a/hosts/common/global/packages.nix +++ b/hosts/common/global/packages.nix @@ -1,6 +1,7 @@ { pkgs, ... }: { environment.systemPackages = with pkgs; [ + nodejs_20 vim ]; } diff --git a/hosts/common/nomad.nix b/hosts/common/nomad.nix index 1bf0289..527b4e3 100644 --- a/hosts/common/nomad.nix +++ b/hosts/common/nomad.nix @@ -22,9 +22,15 @@ in interface = "tailscale0"; cidr = "100.64.0.0/10"; }; - host_volume.code = { - path = "/data/compute/code"; - read_only = true; + host_volume = { + code = { + path = "/data/compute/code"; + read_only = true; + }; + nix-store = { + path = "/nix/store"; + read_only = true; + }; }; }; diff --git a/services/instasync.hcl b/services/instasync.hcl new file mode 100644 index 0000000..1cbf9b2 --- /dev/null +++ b/services/instasync.hcl @@ -0,0 +1,41 @@ +job "instasync" { + datacenters = ["alo"] + + type = "batch" + + periodic { + cron = "*/5 * * * *" + prohibit_overlap = true + } + + group "cron" { + volume "code" { + type = "host" + read_only = true + source = "code" + } + volume "nix-store" { + type = "host" + read_only = true + source = "nix-store" + } + + task "sync" { + driver = "exec" + + config { + command = "/nix/store/2y52nmyfpsq497cppgc43x9v6lkp3q25-nodejs-20.5.1/bin/node" + args = ["/code/instasync/sync.js"] + } + + volume_mount { + volume = "code" + destination = "/code" + } + volume_mount { + volume = "nix-store" + destination = "/nix/store" + } + } + } +}