Setup an Hydra declarative project

This commit adds configuration files ingested an Hydra instance to
create a declarative project.
Currently, this Hydra instance builds
- the master branch
- all pull requests

We use the nix community provided Hydra instance
https://hydra.nix-community.org/project/simple-nixos-mailserver.
This commit is contained in:
Antoine Eiche 2020-04-18 01:03:15 +02:00
parent 09ca79801b
commit 2493056eed
3 changed files with 89 additions and 0 deletions

View file

@ -0,0 +1,58 @@
{ nixpkgs, declInput, pulls }:
let
pkgs = import nixpkgs {};
prs = builtins.fromJSON (builtins.readFile pulls);
prJobsets = pkgs.lib.mapAttrs (num: info:
{ enabled = 1;
hidden = false;
description = "PR ${num}: ${info.title}";
nixexprinput = "snm";
nixexprpath = ".hydra/default.nix";
checkinterval = 30;
schedulingshares = 20;
enableemail = false;
emailoverride = "";
keepnr = 1;
type = 0;
inputs = {
cloudwatt = {
type = "git";
value = "${info.target_repo_url} merge-requests/${info.iid}/head";
emailresponsible = false;
};
};
}
) prs;
desc = prJobsets // {
master = {
description = "Build master branch of Simple NixOS MailServer";
checkinterval = "60";
enabled = "1";
nixexprinput = "snm";
nixexprpath = ".hydra/default.nix";
schedulingshares = 100;
enableemail = false;
emailoverride = "";
keepnr = 3;
hidden = false;
type = 0;
inputs = {
snm = {
value = "https://gitlab.com/simple-nixos-mailserver/nixos-mailserver master";
type = "git";
emailresponsible = false;
};
};
};
};
in {
jobsets = pkgs.runCommand "spec-jobsets.json" {} ''
cat >$out <<EOF
${builtins.toJSON desc}
EOF
'';
}

1
.hydra/default.nix Normal file
View file

@ -0,0 +1 @@
import ../tests

30
.hydra/spec.json Normal file
View file

@ -0,0 +1,30 @@
{
"enabled": 1,
"hidden": false,
"description": "Simple NixOS Mailserver",
"nixexprinput": "nixexpr",
"nixexprpath": ".hydra/declarative-jobsets.nix",
"checkinterval": 60,
"schedulingshares": 100,
"enableemail": false,
"emailoverride": "",
"keepnr": 3,
"type": 0,
"inputs": {
"nixexpr": {
"value": "https://gitlab.com/simple-nixos-mailserver/nixos-mailserver master",
"type": "git",
"emailresponsible": false
},
"nixpkgs": {
"value": "https://github.com/NixOS/nixpkgs 0f920b05cbcdb8c0f3c5c4a8ea29f1f0065c7033 ",
"type": "git",
"emailresponsible": false
},
"pulls": {
"type": "gitlabpulls",
"value": "https://gitlab.com 7219050",
"emailresponsible": false
}
}
}