summaryrefslogtreecommitdiff
path: root/os/kay/modules/github-runner.nix
blob: dd4d48d7e808dca9db875f1976dc0b683869f60c (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
{ config, ... }:
let
  repo = "nocodb/nocodb";
  nocodbRunnerUser = "nocodbrunner";
  user = config.global.userdata.name;
in
{
  sops.secrets = {
    "github-runner/nocodb-registration-token" = { };
    "github-runner/age-master-key" = { };
  };

  # required by github:nocodb/nocodb docker builds
  virtualisation.docker.enable = true;
  users.groups.${nocodbRunnerUser} = { };
  users.extraGroups.docker.members = [
    user
    nocodbRunnerUser
  ];
  users.users.nocodbrunner = {
    name = nocodbRunnerUser;
    group = nocodbRunnerUser;
    isSystemUser = true;
  };
  services.github-runners.kay = {
    user = nocodbRunnerUser;
    group = nocodbRunnerUser;
    enable = true;
    noDefaultLabels = true;
    extraLabels = [ "nix" ];
    tokenFile = config.sops.secrets."github-runner/nocodb-registration-token".path;
    url = "https://github.com/${repo}";
  };

  systemd.services."github-runner-kay" = {
    environment.SOPS_AGE_KEY_FILE = "%d/age-master-key";
    serviceConfig.LoadCredential = "age-master-key:${
      config.sops.secrets."github-runner/age-master-key".path
    }";
  };
}