aboutsummaryrefslogtreecommitdiff
path: root/example/example.hcl
blob: 80da0708e4f35f83e02e53d9f87446b6e6dde073 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
job "example" {
  datacenters = ["dc1"]
  type        = "batch"

  group "example" {
    task "test-host-bin" {
      driver = "exec2"

      config {
        command =  "/bin/sh"
        args = ["-c", "echo hello world"]
        bind_read_only = {
          "/bin" = "/bin",
          "/lib" = "/lib",
          "/lib64" = "/lib64",
          "/usr" = "/usr",
          "/nix" = "/nix",
        }
      }
      user = "lx"
    }

    task "test-nix-hello" {
      driver = "exec2"

      config {
        command = "/sw/bin/nix"
        args = [
          "--extra-experimental-features", "flakes",
          "--extra-experimental-features", "nix-command",
          "run",
          "github:NixOS/nixpkgs#hello"
          ]
        bind = {
          "/nix" = "/nix",
        }
        bind_read_only = {
          "/home/lx/.nix-profile" = "/sw",
        }
      }
      user = "lx"
    }

    task "test-nix-store" {
      driver = "exec2"

      config {
        command =  "/nix/store/30j23057fqnnc1p4jqmq73p0gxgn0frq-bash-5.1-p16/bin/sh"
        args = ["-c", "/nix/store/y41s1vcn0irn9ahn9wh62yx2cygs7qjj-coreutils-8.32/bin/ls /*; /nix/store/y41s1vcn0irn9ahn9wh62yx2cygs7qjj-coreutils-8.32/bin/id"]
        bind_read_only = {
          "/nix" = "/nix",
        }
      }
      user = "lx"
    }
  }
}