summaryrefslogtreecommitdiff
path: root/ext/terranix/cloudflare/pages_projects.nix
blob: 5b6e64e56890b31f873e1c7f22f80a592482c8fa (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
{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 = "./.github/build_site.sh";
        destination_dir = "/dist";
      };

      deployment_configs = let
        environment_variables = {
          MINIFLUX_URL = "https://miniflux.getchoo.com";
        };
      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";
      };
    };
  };
}