Skip to content

Instantly share code, notes, and snippets.

@ocharles
Created December 8, 2017 11:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ocharles/af08b39e472cd504d2a4d6e2ef679002 to your computer and use it in GitHub Desktop.
Save ocharles/af08b39e472cd504d2a4d6e2ef679002 to your computer and use it in GitHub Desktop.
{ nixpkgs ? <nixpkgs>
, declInput ? {}
, pullRequests
}:
let
pkgs = import nixpkgs {};
build-client =
{ description, github }:
{
inherit description;
enabled = 1;
hidden = false;
nixexprpath = "jobs.nix";
nixexprinput = "client";
checkinterval = 5;
schedulingshares = 100;
enableemail = false;
emailoverride = "";
keepnr = 3;
inputs = {
client = {
type = "git";
value = "https://XXX:x-oauth-basic@github.com/${github.owner}/${github.repo} ${github.ref}";
emailresponsible = false;
};
nixpkgs = {
type = "git";
value = "git://github.com/nixos/nixpkgs-channels nixos-17.09";
emailresponsible = false;
};
};
};
build-pull-request =
num: info:
{
name = "client-pr-${num}";
value =
build-client
{
description = "PR #${num}: ${info.title}";
github = {
owner = info.head.repo.owner.login;
repo = info.head.repo.name;
ref = info.head.ref;
};
};
};
prJobsets =
pkgs.lib.listToAttrs
( pkgs.lib.mapAttrsToList build-pull-request
(builtins.fromJSON (builtins.readFile pullRequests)));
jobsetAttrs = {
master =
build-client {
description = "master";
github = {
owner = "circuithub";
repo = "circuithub-client";
ref = "";
};
};
} // prJobsets;
in
{ jobsets = pkgs.writeText "spec.json" (builtins.toJSON jobsetAttrs); }
{
"enabled": 1,
"hidden": false,
"description": "CircuitHub's web interface",
"nixexprinput": "client",
"nixexprpath": "hydra-jobsets.nix",
"checkinterval": 5,
"schedulingshares": 100,
"enableemail": false,
"emailoverride": "",
"keepnr": 3,
"inputs": {
"client": {
"type": "git",
"value": "https://XXX:x-oauth-basic@github.com/circuithub/circuithub-client",
"emailresponsible": false
},
"nixpkgs": {
"type": "git",
"value": "git://github.com/NixOS/nixpkgs.git release-17.09",
"emailresponsible": false
},
"pullRequests": {
"type": "githubpulls",
"value": "circuithub circuithub-client",
"emailresponsible": false
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment