summaryrefslogtreecommitdiff
path: root/ext/terranix/cloudflare/pages_projects.nix
blob: 4c0b076aaafff8aaaf8be6ef3bf75eea11b3777b (plain)
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
58
59
60
{ lib, ... }:
let
  getGitHubRepo =
    { owner, repo_name }:
    {
      type = "github";
      config = {
        inherit owner repo_name;
        production_branch = "main";
      };
    };
in
{
  resource.cloudflare_pages_project = {
    personal_website = {
      account_id = lib.tfRef "var.account_id";
      name = "getchoo-website";
      production_branch = "main";

      source = getGitHubRepo {
        owner = "getchoo";
        repo_name = "website";
      };

      build_config = {
        build_caching = true;
        build_command = "./build-site.sh";
        destination_dir = "/dist";
      };

      deployment_configs =
        let
          environment_variables = {
            ZOLA_VERSION = "0.19.2";
          };
        in
        {
          production = [ { inherit environment_variables; } ];
          preview = [ { inherit environment_variables; } ];
        };
    };

    teawie_api = {
      account_id = lib.tfRef "var.account_id";
      name = "teawie-api";
      production_branch = "main";

      source = getGitHubRepo {
        owner = "getchoo";
        repo_name = "teawieAPI";
      };

      build_config = {
        build_caching = true;
        build_command = "pnpm run lint && pnpm run build";
        destination_dir = "/dist";
      };
    };
  };
}