on requester-simple-fix-fake-phantom help sign in
reflex/jobsets.nix
70 lines 1.9 kB history raw
1{ prs }:
3let
4 pkgs = (import ./reflex-platform.nix {}).nixpkgs;
5 mkFetchGithub = value: {
6 inherit value;
7 type = "git";
8 emailresponsible = false;
9 };
10in
11with pkgs.lib;
12let
13 defaults = jobs: {
14 inherit (jobs) description;
15 enabled = 1;
16 hidden = false;
17 keepnr = 10;
18 schedulingshares = 100;
19 checkinterval = 120;
20 enableemail = false;
21 emailoverride = "";
22 nixexprinput = "reflex";
23 nixexprpath = "release.nix";
24 inputs = jobs.inputs // {
25 nixpkgs = {
26 type = "git";
27 value = "https://github.com/NixOS/nixpkgs-channels nixos-unstable";
28 emailresponsible = false;
29 };
30 config = {
31 type = "nix";
32 value = "{ android_sdk.accept_license = true; }";
33 emailresponsible = false;
34 };
35 };
36 };
37 branchJobset = branch: defaults {
38 description = "reflex-${branch}";
39 inputs = {
40 reflex = {
41 value = "https://github.com/reflex-frp/reflex ${branch}";
42 type = "git";
43 emailresponsible = false;
44 };
45 };
46 };
47 makePr = num: info: {
48 name = "reflex-pr-${num}";
49 value = defaults {
50 description = "#${num}: ${info.title}";
51 inputs = {
52 reflex = {
53 #NOTE: This should really use "pull/${num}/merge"; however, GitHub's
54 #status checks only operate on PR heads. This creates a race
55 #condition, which can currently only be solved by requiring PRs to be
56 #up to date before they're merged. See
57 #https://github.com/isaacs/github/issues/1002
58 value = "https://github.com/reflex-frp/reflex pull/${num}/head";
59 type = "git";
60 emailresponsible = false;
61 };
62 };
63 };
64 };
65 processedPrs = mapAttrs' makePr (builtins.fromJSON (builtins.readFile prs));
66 jobsetsAttrs = processedPrs //
67 genAttrs ["develop"] branchJobset;
68in {
69 jobsets = pkgs.writeText "spec.json" (builtins.toJSON jobsetsAttrs);