at 23.11-pre 1.3 kB view raw
1{ config 2, pkgs 3, lib 4, ... 5}@args: 6 7with lib; 8 9let 10 cfg = config.services.github-runners; 11 12in 13 14{ 15 options.services.github-runners = mkOption { 16 default = {}; 17 type = with types; attrsOf (submodule { options = import ./github-runner/options.nix (args // { 18 # services.github-runners.${name}.name doesn't have a default; it falls back to ${name} below. 19 includeNameDefault = false; 20 }); }); 21 example = { 22 runner1 = { 23 enable = true; 24 url = "https://github.com/owner/repo"; 25 name = "runner1"; 26 tokenFile = "/secrets/token1"; 27 }; 28 29 runner2 = { 30 enable = true; 31 url = "https://github.com/owner/repo"; 32 name = "runner2"; 33 tokenFile = "/secrets/token2"; 34 }; 35 }; 36 description = lib.mdDoc '' 37 Multiple GitHub Runners. 38 ''; 39 }; 40 41 config = { 42 systemd.services = flip mapAttrs' cfg (n: v: 43 let 44 svcName = "github-runner-${n}"; 45 in 46 nameValuePair svcName 47 (import ./github-runner/service.nix (args // { 48 inherit svcName; 49 cfg = v // { 50 name = if v.name != null then v.name else n; 51 }; 52 systemdDir = "github-runner/${n}"; 53 })) 54 ); 55 }; 56 57 meta.maintainers = with maintainers; [ veehaitch newam ]; 58}